Attached are ports of Coro ('the only real threads in perl'), a module to do co-routines and cooperative threading in Perl, and Guard ('safe cleanup blocks'), a dependency for Coro. Both of these are SHARED_ONLY. Coro depends on AnyEvent and Event for the integration with event loops and LWP for Coro::LWP. The license is mostly Perl/Artistic except for libcoro which is BSD.

$ cat devel/p5-Coro/pkg/DESCR This module collection manages continuations in general, most often in
the form of cooperative threads (also called coros, or simply "coro"
in the documentation). They are similar to kernel threads but don't
(in general) run in parallel at the same time even on SMP machines.
The specific flavor of thread offered by this module also guarantees
you that it will not switch between threads unless necessary, at
easily-identified points in your program, so locking and parallel
access are rarely an issue, making thread programming much safer and
easier than using other thread models.
$ cat devel/p5-Guard/pkg/DESCR This module implements so-called "guards". A guard is something
(usually an object) that "guards" a resource, ensuring that it is
cleaned up when expected.

Specifically, this module supports two different types of guards:
guard objects, which execute a given code block when destroyed, and
scoped guards, which are tied to the scope exit.


Coro comes with modules for AIO, EV and BDB which will not work until we have those modules in our ports, but I kept them in the PLIST. This has been tested on i386 (where it passes regress, and seems to work well). It 'should' work on amd64 (where it uses the same code for threading as i386), but really needs to be tested on !(amd64|i386) where it uses setjmp/longjmp/sigaltstack (we have no ucontext) and apparently coroutine creation will be slow but switching will be fast (I don't recommend reading Coro-5.131/Coro/Makefile.PL if you care what the author of this module thinks of the BSDs).


Attachment: devel-p5-Coro.tgz
Description: Binary data

Attachment: devel-p5-Guard.tgz
Description: Binary data

Reply via email to