lua-users home
lua-l archive

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

On Wed, Aug 03, 2005 at 11:56:30AM -0300, Silvana Rossetto wrote:
> Yet another coroutine library in ANSI-C is Portable Coroutine Library(PCL),
> written by Davide Libenzi. It seems nice!

I'm not sure this is pure ANSI C.  The stack/context switching is the
tricky part since C doesn't really have a portable way of doing that.
Looking at the "co_set_context" function in "pcl.c".  It appears to

  - a POSIX sigcontext implementation.

  - a ucontext implementation.

  - a setjmp/longjmp implementation, but that requires the
    ability to directly manipulate the contents of the jmp_buf
    data (which I believe ANSI considers off-limits).  It has
    a bunch of #if statements to test for known GLIBC and WIN32
    C libraries in order to make this work.

So a non-POSIX non-Windows system might not be able to run this code.

                                                  -Dave Dodge