Hi,
I am developing a stripchart application where the data to be charted
comes from a server. There are two classes: one responsible for
communicating with the server and filling of the histograms and the other
one is for gui. The client class spins out a TThread that handles the
messages from the server using the following function:
[code]
static void* RecvFastEvents(void *arg)
{
if(arg == NULL)
return NULL;
//Get the pointer to the current client
OtrClient *clnt = (OtrClient*)arg;
//TTimer *timer = new TTimer();
//For testing
//timer->Start(3000,kFALSE);
//timer->Connect("Timeout()","OtrClient",clnt,"ProcessOtrFastEvent()");
//Check if the socket is valid
if(clnt->fSocket == NULL)
return NULL;
//Sit in a loop
while (1) {
TMessage * msg = NULL;
clnt->fSocket->Recv(msg);
assert(msg);
TObject * o = (TObject*)msg->ReadObject(msg->GetClass());
//Process the collection
clnt->ProcessOtrFastEvent((TObject*)o);
o->Delete();
msg->Delete();
//Increment the number of received events
clnt->fNFastEvents++;
}
};[/code]
Once the event is processed, i.e. histograms get filled, a signal is
generated to the gui class to update the canvas where the histograms were
drawn using the following method:
void OtrHistoDisplay::DoOtrFastViewUpdate()
{
//Raise modified flag for each pad
pd_c1_1->Modified();
pd_c1_2->Modified();
pd_c1_3->Modified();
pd_c1_4->Modified();
//Now update the embedded canvas
c1->Update();
}
The problem is that the call c1->Update() causes the entire application to
freeze.
For the testing purposes i used to have a timer in my thread and
graphics worked quite well then.
Any suggestions will be greatly appreciated.
- Vyacheslav