Hi Stephan,
waitpid, wait3, wait4 etc. should also terminate when a signal for which
an signal handler has been installed is being called so what about
installing a signal handler for SIGUSR1 start an additional timer thread
then call waitpid in the main thread without WNOHANG and have that timer
thread send you a SIGUSR1 after the timeout. Provided we are not already
using SIGUSR1 for any other feature yet.
Kind regards,
Bernd Eilers
Stephan Bergmann wrote:
Hi all,
If you look closer, osl/process.h appears to be a poorly thought out
interface. One you cannot reasonably implement on Unix. Or what am I
missing?
Among others, osl/process.h has osl_executeProcess,
osl_terminateProcess, and osl_joinProcessWithTimeout.
On Unix, osl_executeProcess obviously needs to initiate the fork(2) (and
there obviously needs to be some mapping between the child pid returned
by fork and the oslProcess returned by osl_executeProcess).
osl_terminateProcess, to be of any use, needs to send a kill(2) to the
child pid. However, it must never do so after a waitpid(2) for that pid
has returned successfully.
How, then, do you implement osl_joinProcessWithTimeout? It needs to
call waitpid(2). Since there is no "waitpid with timeout" in Unix, it
moves the waitpid into an extra thread. But how can
osl_terminateProcess and the extra thread do the necessary synchronization?
Can the osl/process.h interface only be implemented correctly with
waitpid WNOHANG and polling? POLLING?!? Please tell me I am missing
the obvious.
-Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]