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:
@@ -204,6 +204,7 @@ NAMES=\
|
||||
unistd/sysconf \
|
||||
pthread/main \
|
||||
pthread/cleanup \
|
||||
pthread/exit \
|
||||
pthread/extjoin \
|
||||
pthread/once \
|
||||
pthread/customstack \
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user