[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Recommendations on my upcoming Lua presentation?
- From: David Given <dg@...>
- Date: Tue, 01 Feb 2011 11:00:24 +0000
On 01/02/11 07:46, Axel Kittenberger wrote:
> How abouot http://www.gnu.org/software/pth/?
Caveat emptor: I have some spam filtering software (spey, <plug>
http://spey.sf.net </plug>) written in C++ that used cooperative
multitasking and coroutines to handle multiple sockets. I wrote my own
coroutine system using getcontext() and setcontext(). It worked really well.
...until I discovered that on some platforms, if you link against a
library that has been compiled to use pthreads, and your code uses a
stack that wasn't created via pthreads, your code will crash in really
bizarre ways (technical details: one of pthreads' way of storing TLS on
platforms that don't have any better way is to put it right at the top
of the stack. It can then find this efficiently by rounding up the
current stack pointer. Of course, this only works if you use pthreads
So now spey has to simulate coroutines by using pthreads and a Great Big
Lock. (Yes, I should have written it in Lua...)
I'd be very surprised if pth didn't suffer from the same problem.
┌─── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ───── http://www.cowlark.com ─────
│ "Thou who might be our Father, who perhaps may be in Heaven, hallowed
│ be Thy Name, if Name Thou hast and any desire to see it hallowed..."
│ --- _Creatures of Light and Darkness_, Roger Zelazny
Description: OpenPGP digital signature