Hez,

Just a gut reaction, but it seems a reasonable goal/expectation would be that 
the library should be thread-safe at the stream level, meaning that once a 
stream is created (and probably while listed in what is a globally 
mutex-protected list), independent threads can safely use separate streams.  
Using thread-local storage rather than globals might go a long way to allow 
that.  Comments?

Bill



________________________________________
From: Hezekiah M. Carty [[email protected]]
Sent: Wednesday, September 29, 2010 11:16 AM
To: Johan Mazel
Cc: [email protected]
Subject: Re: [Plplot-general] Error using threads, GTK and Cairo driver

On Wed, Sep 29, 2010 at 7:49 AM, Johan Mazel <[email protected]> wrote:
> Hi
> I fixed this problem.
> The solution is to used a global mutex that forbids any simultanate use of
> PLplot primitives.
> Especially when you are using class to handle each graph. Each class
> handling a graph need to use this mutex to synchronize itself with all the
> other graphs.
>
> I don't know in which way my first implementation with mutexes was wrong but
> this implementation fixes the problem.
>
> Regards.
> Johan Mazel
>

Johan,

I'm glad you got it to work!  I have/had an OCaml + PLplot + Gtk +
threads example sitting on my drive somewhere, but I haven't been able
to find it.  Your solution is close to what I used.  PLplot is not
thread-safe internally, so it is very important to only allow one
thread to utilize PLplot at a time.

Hez

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Plplot-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Plplot-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to