20 lines
408 B
C
20 lines
408 B
C
#include <pthread.h>
|
|
#include <assert.h>
|
|
#include <stdio.h>
|
|
|
|
static void *function(void *arg) {
|
|
printf("This is thread %u\n", pthread_self());
|
|
printf("argument: %s\n", (const char *) arg);
|
|
return NULL;
|
|
}
|
|
|
|
int main(int argc, const char **argv) {
|
|
pthread_t thread;
|
|
|
|
assert(pthread_create(&thread, NULL, function, (void *) "thread1") == 0);
|
|
|
|
pthread_join(thread, NULL);
|
|
|
|
return 0;
|
|
}
|