On Mon, Oct 10, 2011 at 2:19 AM, Sisyphus <[email protected]> wrote:
> Hi,
>
> Is there an option for achieving a "thread-safe" build of plplot ?
>
> On Win32, the use of the 'fork' function in the PDL::Graphics::PLplot (perl)
> module test script causes a problem - namely that, after the forked process
> has exited, there's still *something* hanging about that intereferes with
> the way that the remainder of the script behaves.
> On Win32 perls, fork() is implemented via multi-threading, and I suspect
> that this problem might go away if one (or more) plplot global(s) was
> instead assigned on a per-thread basis using TLS (thread local storage).
>
> My diagnosis might be quite wrong, but....
>
> Cheers,
> Rob
>

Rob,

Your diagnosis is likely dead on.  I have not used PLplot + Perl +
fork + Windows, but if it works the way you suggest then using PLplot
in that environment is unsafe.  There are a number of global state
variables used, both in tracking the current state of PLplot as a
whole as well as in certain plotting functions.  The only safe way to
use PLplot in this environment is to ensure that PLplot calls are all
handled from a single thread.  If you do have a way to spawn multiple,
independent processes then using PLplot in each of those processes
would be safe.

Thread safety would be a wonderful thing to have in PLplot, and it
will hopefully be added at some point.  This work will require a large
number of changes to PLplot's internals and likely broad changes to
the API as well.  Contributions toward this, of course, are more than
welcome!

I hope this helps,

Hez

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Plplot-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to