3 Aug 2011 04:40
Re: external events api
Roderic Morris <roderyc <at> gmail.com>
2011-08-03 02:40:52 GMT
2011-08-03 02:40:52 GMT
On Jul 25, 2011, at 1:49 AM, Marcus Crestani wrote: > 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. Ahh, thanks, I was looking in 1.8's manual. > 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. Ok. I just created some c functions that do only those actions (note, create, or unregister) to make experimenting with this easier. I've run into what look like bugs in this API unfortunately. I've tried a few things to try to get wait-for-child-process to use wait-for-external-events, and most have worked in the simple and most common case of only one thread waiting on a particular process id, but all have failed for some reason on the multiple thread case. In the first one, I tried noting and unregistering a process id's external event uid as soon as the sigchld came in. That didn't work, and it's reasonable that the external events system would require you to unregister after all waiting threads are awake. In the next, I tried having all threads waiting on a given process id wait on one uid that was a field of the process id. I expected that they'd all be woken up when the uid was noted, but only the first thread to wait did. I didn't think that was right, but I tried to get around it, and at least get wait-for-child-process working. For the next implementation, i tried having a process id have a queue of uids which would be added to when a process waits on it. All the uids in the queue would be noted when the sigchld comes in, and each thread would unregister the uid it added to the queue. In this case too, only the first thread that waited is woken.(Continue reading)
RSS Feed