Re: X11 and Threads...

From: Christian Holm Christensen <cholm_at_nbi.dk>
Date: Fri, 22 Dec 2006 09:14:08 +0100


Hi Daniel,

On Thu, 2006-12-21 at 17:48 +0100, Fons Rademakers wrote:
> Hi Daniel,
>
> updating canvases from different threads is not supported. What should
> be done is to concentrate all canvas drawing in one thread while the object
> being drawn can be modified in different threads (like histogram or graph
> updating). See for example the tutorial: tutorials/thread/threadsh1.C.

Alternatively, you can do your own lock-ing, using a mutex. Encapsulate the canvas in a class, and attach a lock. Then make sure you always sync using that lock.

If all you need is to occationally update a canvas while the program is collection or processing data, you'd be better of with a periodic TTimer.

Yours,

-- 
 ___  |  Christian Holm Christensen 
  |_| |  -------------------------------------------------------------
    | |  Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
     _|           DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
    _|            Denmark                    Office: (+45) 353  25 404
 ____|   Email:   cholm_at_nbi.dk               Web:    www.nbi.dk/~cholm
 | |
Received on Fri Dec 22 2006 - 09:14:15 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:02 MET