mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Introduce __cxa_thread_atexit()
This commit is contained in:
parent
a699cda5c8
commit
ee82f90bba
6 changed files with 98 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/cxaatexit.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/testlib/subprocess.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
@ -66,3 +67,21 @@ TEST(pthread_exit, detachedOrphanedChild_runsAtexitHandlers) {
|
|||
pthread_exit(0);
|
||||
EXITS(CHILD);
|
||||
}
|
||||
|
||||
void OnMainThreadExit(void *arg) {
|
||||
_Exit((long)arg);
|
||||
}
|
||||
|
||||
TEST(__cxa_thread_atexit, exit_wontInvokeThreadDestructors) {
|
||||
SPAWN(fork);
|
||||
__cxa_thread_atexit(OnMainThreadExit, (void *)123L, 0);
|
||||
exit(0);
|
||||
EXITS(0);
|
||||
}
|
||||
|
||||
TEST(__cxa_thread_atexit, pthread_exit_willInvokeThreadDestructors) {
|
||||
SPAWN(fork);
|
||||
__cxa_thread_atexit(OnMainThreadExit, (void *)123L, 0);
|
||||
pthread_exit(0);
|
||||
EXITS(123);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue