mirror of
https://github.com/tiennm99/HDH.git
synced 2026-06-09 10:12:23 +00:00
Update
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
void *hello(void *tid)
|
||||
{
|
||||
printf("Hello from thread %ld\n", (long)tid);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
pthread_t tid[10];
|
||||
long i;
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
pthread_create(&tid[i], NULL, hello, (void *)i);
|
||||
pthread_join(tid[i], NULL);
|
||||
}
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user