[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Threads again
- From: Sergey Redin <sergey@...>
- Date: Mon, 30 Jan 2006 04:38:03 +0800
On Sun, 29 Jan 2006 16:46:11 +0100
Wim Couwenberg <w.couwenberg@chello.nl> wrote:
Thanks for your explanations. I have already understood myself that I
cannot use such scheme and also, after some tests, that I don't really
need anything like that. I have to forget about loading my database
as a Lua script, but that's not a problems at all. Loading previously
mmaped script (even not processed with luac) of 1000 lines is quick
enough for me (10000 lines are worse, but I don't need so large
scripts without the database in script).
So I will create a new universe each time, this is the simplest and
safest solution, and quick enough for me.
> > After the thread is finished, I close the Lua thread, lock the mutex
>
> Close the thread? Extra states created with lua_newthread cannot be
> closed explicitly, only by a garbage collect cycle (possibly when the
> administration state is closed.) Closing a thread and then removing
> it from the registry doesn't help either, the garbage collector will
> know of its existence anyway (obviously.) This will lead to double
> destruction of your thread...
Yet another stupidity from my side, thank you. Sorry, I'm new to Lua, I
did not even read its source yet (only the manual, PiL and a few threads
from this list archive for the last few months)...
But still I'm curious. What if I modify the garbage collector and
make it lock the same mutex before it starts? Is GC the only problem
here, and this recipe will solve it?
--
Regards, Sergey Redin.