以下の内容はhttps://higepon.hatenablog.com/entry/20060125/1138191092より取得しました。


cygwinでpthread

#include <stdio.h>
#include <pthread.h>
#include <unistd.h>

void* test(void* param)
{
    for (int i = 0; i < 10; i++)
    {
        printf("[%d]", i);
        fflush(stdout);
    }
    return NULL;
}

int main(int argc, char** argv)
{
    pthread_t tid;
    int param;
    pthread_create(&tid, NULL, test, (void*)param);
    pthread_join(tid,NULL);
    sleep(20);
    printf("thread done\n");
    return 0;
}

cygwinでpthread。
これくらい簡単なサンプルなら意図通りに動く。
でも、NetServerに組み込んだらpthread_createでハングするようになった。
原因を深追いせずWindowsのthread機能を利用することに。




以上の内容はhttps://higepon.hatenablog.com/entry/20060125/1138191092より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14