Files
RedBear-OS/tests/pthread/exit.c
T
4lDO2 9e769fcb57 Add pthread_exit test.
This caught a bug in the kernel where it would return Ok(24) when
passing zero extra-munmap length.
2025-04-19 19:27:00 +02:00

32 lines
543 B
C

#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);
}