Re: external events api

Michael Sperber <[email protected]> Mon, 25 Jul 2011 08:23:55 +0200
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <[email protected]>
Roderic Morris <[email protected]> writes:

> while looking into the deadlock detection issue with a friend, we
> noticed the external events api in the vm and rts/external-events
> package. It seems that the code that checks for deadlocks checks if
> there are any external events being waited on if every thread is
> blocked. Why don't we change the posix package's wait implementation
> (and anything else appropriate in there) to use that mechanism?

That seems appropriate.

> If that sounds like a good idea, then I just want to ask if anyone
> knows the right way to use it.

I do :-)

> It's not documented as far as I see, but looking at its usage in the
> address package (see c/net/address.c and scheme/net/address.scm), it
> seems that we need to first create an external event uuid with
> s48_external_event_uid(), call wait-for-external-event on it, then use
> s48_note_external_event() in whatever thread the event is completed
> on, and finally release the uid when the original thread wakes up with
> s48_unregister_external_event_uid().

That's the case for temporary events like a DNS lookup.  The idea was
that for stuff like the GUI event loop, you'd have a permanent uid.

> If that's right, then I wonder if there are equivalents to those s48_*
> c functions in some scheme package? It looks like it'd be more
> straight forward to just create and unregister the uids in scheme.

That may be true - I believe I wanted to avoid having to add a VM
extension, or more external functions.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla