This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
As you noted there are potential race conditions as there is no way to simultaneously unblock signals and wait for a process and the signal.
The answer is to send the signals in a loop until the forking thread
leaves wait().
As for what signal to use, anything should be ok provided we don't conflict with the GC's signals. posix-threads.cc defines a signal to implement interrupt(), perhaps we could use that. The sigwait() would handle both SIGCHLD and the "wake up" signal.
This ought to work so long as SIGCHLD is guaranteed to be delivered to the same thread which spawned the process? I'm not sure if this is guaranteed by the POSIX spec or not.
This is my problem with using the SIGCHLD/sigwait() combination. I
don't know for sure how to guarantee that the signal is handled on the
proper thread on all possible Posix platforms (not being a Posix expert
and all). Does calling sigaction() from a thread guarantee that
sigwait() on the same thread will wake up on that signal? I do not know.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |