[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT + Pluto coroutine issue
- From: Mike Pall <mikelu-0512@...>
- Date: Tue, 6 Dec 2005 18:04:42 +0100
Jan Reijnen wrote:
> GetCurrentFiber() never returns NULL so ConvertThreadToFiber() is never
Are you sure? This does not match the behaviour of Wine or Win98.
Try this little program:
main(int argc, char **argv)
With Wine I get:
With Win98 I get:
So this indicates that GetCurrentFiber _does_ return NULL for a
newly created process (i.e a subsequent SwitchToFiber() would
crash). Maybe this is different for other Windows versions?
AFAIK GetCurrentFiber() is just a macro that gets the FiberData
pointer from the current TIB. And this pointer is initialized
with NULL (i.e. no Fiber data structure has been allocated).
IMHO my use of GetCurrentFiber() prevents needless calls to
ConvertThreadToFiber() (and a memory leak in Wine). Windows
experts to the rescue -- please correct me if I'm wrong.