[Suzaku:00023] Threadは可能ですか?
yoshizu kyosuke
email@hidden
2004年 6月 7日 (月) 08:59:02 JST
threadの実験を行おうと思い
以下のソースを Redhat Linuxでコンパイル後実行し動作確認した後
μCLinuxでMakeしようとしましたが make成功しません
Makefileは添付CDのものに -lpthreadをつけたりしましたがだめでした
μCLinuxではTheadは利用できないのでしょうか?
---------------------------------------------------------------------
#include <stdio.h>
#include <pthread.h>
void *counter1()
{
int i;
i=0;
while(1){
sleep(1);
printf("thread1=%d\n",i);
i++;
}
}
void *counter2()
{
int i;
i=0;
while(1){
sleep(5);
printf(" thread2=%d\n",i);
i++;
}
}
main()
{
pthread_t thread_id1,thread_id2;
pthread_create(&thread_id1,NULL,counter1,(void *)NULL);
pthread_create(&thread_id2,NULL,counter2,(void *)NULL);
while(1){
sleep(1);
}
}
cc -o thread_test thread_test.c -lpthread
-------------------------------------------------------------------
以上よろしくお願い致します
suzaku メーリングリストの案内