(empth_init_signals): Don't catch SIGINT and SIGTERM.
(empth_wait_for_shutdown): New. (main): Use it to wait for shutdown signal, then shut down. Closes #770492. (empth_exit): Remove the weird special case for main thread. Implement empth_wait_for_shutdown() for EMPTH_LWP: [EMPTH_LWP] (lwpInitSigWait, lwpSigWait, lwpSigWakeup): New. Declaration of lwpSigWait was accidentally committed in the previous revision of lwp.h. [EMPTH_LWP] (lwpInitSystem): New parameter waitset, pass it on to lwpInitSigWait(). [EMPTH_LWP] (lwpReschedule): Call lwpSigWakeup(). [EMPTH_LWP] (empth_init): Declare signals needed by empth_wait_for_shutdown(). (empth_wait_for_shutdown): Implement on top of lwpSigWait(). Implement empth_wait_for_shutdown() for EMPTH_POSIX: [EMPTH_POSIX] (empth_init): Block signals, so that empth_wait_for_shutdown() can use sigwait() safely. (empth_wait_for_shutdown): Implement on top of sigwait(). Implement empth_wait_for_shutdown() for EMPTH_W32: (empth_wait_for_shutdown): Implement on top of loc_BlockMainThread().
This commit is contained in:
parent
f51769659c
commit
7183516d91
10 changed files with 251 additions and 71 deletions
|
@ -144,6 +144,9 @@ empth_t *empth_self(void);
|
|||
|
||||
/*
|
||||
* Terminate the current thread.
|
||||
* The current thread should not be the thread that executed main().
|
||||
* If it is, implementations may terminate the process rather than the
|
||||
* thread.
|
||||
* Never returns.
|
||||
*/
|
||||
void empth_exit(void);
|
||||
|
@ -184,6 +187,12 @@ void empth_wakeup(empth_t *thread);
|
|||
*/
|
||||
void empth_sleep(time_t until);
|
||||
|
||||
/*
|
||||
* Wait for some implementation-defined external shutdown signal.
|
||||
* Return a non-negative number identifying the signal.
|
||||
*/
|
||||
int empth_wait_for_shutdown(void);
|
||||
|
||||
/*
|
||||
* Create a semaphore.
|
||||
* NAME is its name, it is used for debugging.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue