The Portable Coroutine Library (PCL) implements the low level functionality for coroutines. For a definition of the term coroutine see The Art of Computer Programming by Donald E. Knuth. Coroutines are a very simple cooperative multitasking environment where the switch from one task to another is done explicitly by a function call. Coroutines are a lot faster than processes or threads switch, since there is no OS kernel involvement for the operation. Also coroutines require much less OS resources than processes of threads. The idea of writing this library started when I was testing Linux epoll functionality and performance. I initially started using the coro library by E. Toernig <firstname.lastname@example.org> and I found the library very interesting. It was simple and yet powerful. The limitations of the coro library were both non portability and crashes when not used together with certain versions of gcc. So I decided to write a new library to address the problems aforementioned by also taking portable context switching ideas from the GNU Pth library. This library is easily portable on almost every Unix system and on Windows. It can use either the ucontext.h functionalities ( getcontext()/makecontest()/swapcontext() ) or the standard longjmp()/setjmp().
Page created in 0.03 seconds with 22 queries.