Re: external events api
Roderic Morris <[email protected]> Wed, 10 Aug 2011 23:36:58 -0400
| Newsgroups | gmane.lisp.scheme.scheme48 |
|---|---|
| Message-ID | <[email protected]> |
On Aug 3, 2011, at 1:59 PM, Marcus Crestani wrote: Should've replied to this sooner, but I've been busy. I think we have a misunderstanding. >>>>>> "RM" == Roderic Morris <[email protected]> writes: > RM> It seems that this api has trouble with notes happening in quick > RM> succession. > > Yes, it is not guaranteed that every `s48_note_external_event' gets > handled immediately. That's why external code has to collect multiple > external events and provide a mechanism for Scheme to obtain *all* > occurred events that have not yet been obtained before. I understand that. The problem is that some of those calls are *never* handled. I've left the process idling for quite a while without them being woken. Moreover, after the first time a thread fails to wake up, all subsequent calls to s48_note_external_event have no effect, even on brand new event ids. > I took a quick look at your patch and I think you should try the > following: > > - In `process-terminated-children' you have to collect all terminated > children, e.g. put them in a list. > > - In `really-wait-for-child-process' you have to obtain that list of > terminated children after `wait-for-external-event' returns. Then, > process every terminated child by unblocking previously called > `wait-for-child-process', for example via the placeholder in > process-id. > > This way you should not lose any terminated child. This is basically going back to what was their before. The reason I'm changing the code to not block on a placeholder is because of the deadlock detection. If I block on a placeholder with only one thread running, it'll detect a deadlock. I want to use the wait-for-external-event stuff so that won't happen. The problem is not missing terminated children. I'm noting everywhere I should, but the notes are having no effect in certain situations (as the last email said). -Roderic