[m-dev.] thread.spawn_native

Paul Bone paul at bone.id.au
Wed Jun 11 12:35:53 AEST 2014


On Wed, Jun 11, 2014 at 12:20:43PM +1000, Peter Wang wrote:
> 
> The problem is when two Mercury contexts try to use the same library
> simultaneously.  They cannot rely on thread-local state to persist
> across calls:
> 
>     1. context-1 calls liba.set(1) -- performed on IO-thread-1
>     2. context-2 calls liba.set(2) -- also performed on IO-thread-1
>     3. context-1 calls liba.get -- performed on IO-thread-1
> 

Why doesn't each context use a handle or pointer to refer to it's own set of
data in liba.  liba's API is very limited if it doesn't allow for this.

What is the concrete problem you're trying to solve?  Are you able to edit
the library code?  Why do you need seperate instances of the same library?

Thanks.


-- 
Paul Bone



More information about the developers mailing list