08/04/08 21:07:28 XvUI6Eqt
>>392>>394
こんなサンプルプログラムを走らせるとこんな感じになる。
URLリンク(usamimi.info)
$ cat tp.c
#include <pthread.h>
void *sub1(void *data) { for (;;) { } return NULL; }
int main(int argc, char *argv[])
{
pthread_t t1, t2;
pthread_create(&t1, NULL, sub1, NULL);
pthread_create(&t2, NULL, sub1, NULL);
pthread_join(t1, NULL);
pthread_join(t2, NULL);
return 0;
}
$ gcc -o tp tp.c -lpthread
$ ./tp