#include <stdio.h>
#include <pthread.h>
void *function(void *p)
{
printf("function(): thread id = %ld\n", (long) pthread_self());
pthread_exit(NULL);
return NULL;
}
int main()
{
pthread_t thread;
pthread_create(&thread, NULL, function, NULL);
printf("main(): thread id = %ld\n", (long) thread);
pthread_join(thread, NULL);
return 0;
}
/*
run:
main(): thread id = 1
function(): thread id = 1
*/