Hi Thomas, if you have several threads, you can update X only from one of them. The thing you could do is to let the other threads post events to the main thread, these events will then be synchronously processed by the main thread that updates X. Timers by default are synchronous, i.e. they are processed in ProcessEvent() if they have timed out by the time this method is run. Async timers use the SIGALRM to interrupt a process in the middle of its work (can be inside some X11 processing) and should never be used to do some real work that could change the current processing path. The safest thing to do in an async timer is to set a semaphore that can be checked by the main thread once it has finished its current business. -- Fons On Sun, 2002-12-08 at 13:18, Thomas Bretz wrote: > Hi all, > > I'm using gVirtualX->CopyArea to copy a bitmap (a picture from a CCD) into > a TGFrame from a 'second' thread. This is done 25 times a second. Because > it seems, that X is not Thread safe I alwys get an 'Unexpected async > reply'. Now I tried to use an Async Timer to update the picture on the > screen, but this timers are only 'checked' if an event is posted to the > event-queue. Posting an event 25 times a second also results in an > immediate call to gVirtualX->Copy area which results in the same error. > > How can I use gVirtualX->CopyArea to update the screen at any time I want > (or let's say n-times a second) without colliding with X calls in another > thread (the root main thread I guess). It must not be 100% in time and it > is not necessary, that all pictures are really displayed. > > For a fast answer I would be very glad, because I'm in hurry. > > Best regards, > Thomas. -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:23 MET