Roderic Morris | 25 Jul 02:04 2011
Picon

external events api

Hey everyone,

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?

If that sounds like a good idea, then I just want to ask if anyone knows the right way to use it. 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(). 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.

-Roderic

Marcus Crestani | 25 Jul 07:49 2011
Picon

Re: external events api

>>>>>"RM" == Roderic Morris <roderyc <at> gmail.com> writes:
RM> It's not documented as far as I see, 

There is a section "External events" in the development version of the
documentation that describes how to use external events, see
doc/src/external.tex.

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

That sounds correct.

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

Right, since the uids have to be shared between Scheme and C anyway,
they could also be created in Scheme and then exported to C.  This
functionality is currently only in the VM, though.

--

-- 
Marcus

Michael Sperber | 25 Jul 08:23 2011
Picon

Re: external events api


Roderic Morris <roderyc <at> gmail.com> 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
(Continue reading)


Gmane