[erlisp-devel] openmcl patches

Dirk Gerrits dirk at dirkgerrits.com
Thu Sep 1 18:39:13 UTC 2005


bryan o'connor wrote:
> i reworked my openmcl-threads patch to use semaphores.
> 
> my first pass was just blindly porting the allegro patches
> since openmcl's mp support started out very similar.  this
> version is hopefully a little less revolting..  ;)

Well it was no more revolting than the current CMUCL and AllegroCL
backends. ;)

> darcs: http://monday-monkey.com/repos/erlisp/

This seems a lot better, though I still can't test it. ;)  That the
following scenario can occur is a bit unfortunate though, but it's
probably not a huge problem:

* RECEIVE suspends the current process.
* Another process sends N messages, so the semaphore is incremented by
   N.
* The RECEIVEing process wakes up and decrements the semaphore by 1.
   All new messages since the last time are examined.  Let's assume
   nothing matches.
* The semaphore now still has a count of N-1, so instead of blocking
   immediately, the RECEIVEing process will do N-1 more checks (in vain)
   for newly arrived messages.

BTW, that unlock/lock around wait-on-semaphore: good call.  I forgot
that in the AllegroCL code I posted earlier.  (Though I guess I would
have found out sooner or later. ;))

- Dirk




More information about the Erlisp-devel mailing list