Re: Fiber based coroutines
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Fiber based coroutines
- From: Wim Couwenberg <wcou@...>
- Date: 2005年8月09日 08:56:16 +0200
And questions for Wim,
Can you further explain the weak keyed table?
A fiber is a pair (userdata, lua thread). The lua thread part is
private to the userdata. To prevent the lua threads from early gc, I
maintain a weak keyed mapping { userdata --> lua thread }. As soon as
the fiber dies I remove the userdata to allow gc of the thread. Of
course when the userdata is gc'ed there is obviously no need to remove
it from this mapping explicitly.
and
I think it would be a good idea to add a __gc to something that
will execute ConvertFiberToThread() when lua_close() is called.
Maybe, but (as already mentioned in the CoCo thread) this is a fairly
new API call and it is certainly not available on my Win 98 based machine!
Also the documentation of CreateFiber is a bit worrying since it
mentions some FP state problem. CreateFiberEx should fix that, but is
only available since some W2K version.
--
Wim