lua-users home
lua-l archive

Re: C coroutines in ANSI C

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It would appear (from reading the doco) that Fibers in Win32, would 
allow a fairly easy implementation of C coros for Lua. These APIs
are fairly close to ucontext and could emulate the ucontext suite
of functions. See 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/fibers.asp
Fibers are supported for 98/me and NT3.51 forward. Sorry no WIn95.
So, for recent *nix and Win32 there would seem to be a way to implement.
The older Unixes represent a bit of a problem. Would it be viable to 
implement C coroutines for Lua only for recent Unix and most Win32
platforms? 
I guess this would mean something like 
require 'coroutine'
would be needed to use coroutines.
At Lua build time it would not be too difficult to engineer a process that
only builds the C coro support if ucontext or fibers are available.
Is this sort of approach acceptable?
David B

AltStyle によって変換されたページ (->オリジナル) /