Daniel Turing a écrit :
Hi there,

i have a bug here that relates to neko's gc finalization. I have many objects 
of the same kind that in their finalize method unregister from a global list, 
so the finalize method is not threadsafe.

It seems it is called a few times in parallel, though. I see two options for 
what's happening:
 1) boehm-gc indeed somehow finalizes things in parallel (although i dont see 
that would make much sense)
 2) as the bug occurs primarily when i use more than a single thread, i suspect 
the gc is triggered in parallel from different threads. Could this happen? If 
so, how could i avoid it?

I think that Boehm GC can perform parallel sweep phase, and thus finalizers might be called in parallel threads. You have to make your global list MT-safe by using a lock.

Try to include (NEKO)/vm/context.h and you can use context_lock_new context_lock , context_release and context_lock_delete.

Best,
Nicolas


--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to