Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@
Expand Down
23 changes: 23 additions & 0 deletions tests/threadspawn1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <assert.h>
#include <pthread.h>

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