Roderic Morris
2011-07-25 00:04:24 UTC
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
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