diff --git a/Makefile b/Makefile index 8dd0717..ce4e1a6 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ processes: $(processes) threads: $(threads) posix_semaphore1_processes_FLAGS+=-lpthread +threadspawn1_processes_FLAGS+=-lpthread $(processes): %_processes: tests/%.o main.c $(CC) $(CFLAGS) main.c $< $($@_FLAGS) $(LDFLAGS) -o $@ diff --git a/tests/threadspawn1.c b/tests/threadspawn1.c new file mode 100644 index 0000000..a7f6e8c --- /dev/null +++ b/tests/threadspawn1.c @@ -0,0 +1,23 @@ +#include +#include + +char *testcase_description = "Thread creation and teardown"; + +static void *worker(void *arg) +{ + return (NULL); +} + +void testcase(unsigned long long *iterations, unsigned long nr) +{ + pthread_t thread; + int error; + + while (1) { + error = pthread_create(&thread, NULL, worker, NULL); + assert(error == 0); + error = pthread_join(thread, NULL); + assert(error == 0); + (*iterations)++; + } +}