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機能を利用することに。