lua-users home
lua-l archive

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


the stand-alone version of Coco 1.1.0 relative to Lua 5.1 (final)
has been released. It includes some bug fixes and improvements
compared to the pre-release (see the changelog below).

Here is the link to the project home page with full docs:

And a direct link to the download page:

A small excerpt from the docs is below.



Coco is a small extension to get True C Coroutine semantics for
Lua 5.1. 

The stand-alone release is a patchset (18K) against the standard
Lua 5.1 distribution.


True C coroutine semantics mean you can yield from a coroutine
across a C call boundary and resume back to it. 

Coco allows you to use a dedicated C stack for each coroutine.
Resuming a coroutine and yielding from a coroutine automatically
switches C stacks, too. 

In particular you can now: 
- Yield across all metamethods (not advised for __gc).
- Yield across iterator functions (for x in func do).
- Yield across callbacks (table.foreach(), dofile(), ...).
- Yield across protected callbacks (pcall(), xpcall(), ...).
- Yield from C functions and resume back to them.

Best of all, you don't need to change your Lua or C sources and
still get the benefits. It's fully integrated into the Lua core,
but tries to minimize the required changes.


Coco needs some machine-specific features which are inherently
non-portable. Although the coverage is pretty good, this means
that Coco will probably never be a standard part of the Lua core
(which is pure ANSI C).

It works on almost all POSIX platforms and Windows versions.
A detailed list of supported platforms is here:

Changes for Coco 1.1.0 - 2006-02-18

* Upgraded to patch cleanly into Lua 5.1 (final).
* Added GCC inline assembler for context switching on x86 and MIPS32
  [up to 3x faster].
* New targets for setjmp method: Mac OS X/x86, Solaris/x86 and x64
  and Linux/MIPS32.
* Workaround for WinXP problem with GetCurrentFiber().
* The minimum C stack size has been increased to 32K+4K.
* Removed lcocolib.c and integrated the (much smaller) changes
  into lbaselib.c. Note for embedders: this means you no longer
  need to call luaopen_coco().
* Optional Valgrind support requires version 3.x. Renamed define
* C stacks are now registered with Valgrind.