[Live-devel] using live in multi-threaded environment
Ross Finlayson
finlayson at live.com
Wed Sep 8 15:52:38 PDT 2004
> Because the library code assumes a single thread of control, you should
> not
> have more than one thread accessing the library, *unless* each thread uses
> its own "UsageEnvironment" and "TaskScheduler" object.
>
> In other words, multiple threads can use the library code, but only if
> they're performing independent activities.
>
> Is this really true? The groupsock libs seem to be using some static
> vars that won't work in a multi-threaded environment.
That's not supposed to be happening. (Several static and global variables
got removed (and moved instead to "UsageEnvironment"-specific state) a few
months ago, but it's conceivable that there are some remaining variables
that might cause a problem.)
> In particular, I don't think the random number generation is thread safe
You could well be right; I'll look into this. In the meantime, you could
try putting a mutex around that code.
> Is my alternative to run everything through a single thread?
That's always an option :-)
Ross Finlayson
LIVE.COM
<http://www.live.com/>
More information about the live-devel
mailing list