[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] GM2 coroutines
From: |
Gaius Mulley |
Subject: |
Re: [Gm2] GM2 coroutines |
Date: |
Mon, 02 Mar 2009 22:21:32 +0000 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
> Benjamin Kowarsch <address@hidden> writes:
>
>> Hi
>>
>> Recently I was looking at the status of GM2 again to see if we might be able
>> to
>> use it for embedded work under FreeBSD.
>>
>> From a paper by Gaius about GM2, it would seem to me that coroutines had been
>> implemented using the pthread library. I presume this was an interim shortcut
>> since of course coroutines are not meant to be preempted.
>>
>> For what we do, it is of paramount importance to have true coroutines instead
>> of pthreads. Therefore, I am wondering if true coroutines have since been
>> implemented, or if not, whether there are any plans to do so.
Hi Benjamin,
just to clarify and answer the questions directly - the implementation
provides the PIM coroutine procedures TRANSFER, IOTRANSFER, NEWPROCESS
and LISTEN, they are all non-preemptive. In fact I thought this was a
slight weakness of the implementation in that IOTRANSFER will only
return to the original callee when another process calls LISTEN or
calls a procedure which is in a module with a lower interrupt priority
or explicitly calls a runtime support procedure function
TurnInterrupts (used to build LISTEN). All other code is treated as
being atomic. Still I believe this satisfies the semantics of
IOTRANSFER, TRANSFER et al.
regards,
Gaius