On Wed, 2009-01-28 at 20:52 +0100, Daniel Turing wrote:
> i'll post again if i find a reproducible, small sample for my
> problems.

So, i've found the cause of my problems. It's not quite easy to
reproduce but relatively easy to explain:

I run just two threads, let's call them "Main" and "Worker". Main is a
usual Xinfinity program with its usual OpenGL calls.  Worker is a
background resource loader/renderer, that renders into memory buffers
(not directly to GL textures).

What actually happens is that the worker thread needs to allocate some
memory, and, in the process, triggers boehm's GC. This finds some stuff
to delete that is not safe to delete from that thread. GL is not fully
threadsafe (please dont ask me about the details ;) Suffice to say there
is no simple way to keep a lock for the destructor (it already locks
itself per older discussion on a similar topic).

Now, i think the best solution would be to temporarily disable garbage
collection when this thread actually does its work. GC_enable/GC_disable
are not represented in the neko API, but i guess they could be. What do
you think about that, Nicolas?

I guess that manually triggering the GC just before Worker does its
deeds might minimize the problem, but not very elegantly...

Regards,
-dan



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

Reply via email to