Add pthread_exit test.

This caught a bug in the kernel where it would return Ok(24) when
passing zero extra-munmap length.
This commit is contained in:
4lDO2
2025-04-10 15:33:36 +02:00
parent cc6fadb8bb
commit 9e769fcb57
2 changed files with 32 additions and 0 deletions
+1
View File
@@ -204,6 +204,7 @@ NAMES=\
unistd/sysconf \
pthread/main \
pthread/cleanup \
pthread/exit \
pthread/extjoin \
pthread/once \
pthread/customstack \
+31
View File
@@ -0,0 +1,31 @@
#include <assert.h>
#include <stddef.h>
#include <unistd.h>
#include <pthread.h>
#include "common.h"
void *routine(void *arg) {
assert(arg == NULL);
sleep(1);
puts("Thread ");
return NULL;
}
int main(void) {
int status;
pthread_t thread;
if ((status = pthread_create(&thread, NULL, routine, NULL)) != 0) {
return fail(status, "failed to create thread");
}
if ((status = pthread_detach(thread)) != 0) {
return fail(status, "failed to detach thread");
}
pthread_exit(NULL);
}