如何在windows下执行“pthread”?

时间:2011-06-22 11:42:51

标签: c++ c windows multithreading cross-platform

我试过了:

1)POSIX Threads for Win32myfiles1

我所做的是将“lib”和“include”文件夹中的文件从“Pre-built.2”目录复制到我的项目目录,并将此行添加到mapping.cpp

#pragma comment(lib, "pthreadVC2.lib")

2)和this tutorialmyfiles2

但我无法弄清楚如何改变这一部分:

#if defined(LINUX)
    pthread_t thread_print;

    int iret_print;
    iret_print = pthread_create( &thread_print, NULL, glRender, (void*) &globalOG);
#elif defined(WINDOWS)
    HANDLE  thread_id;
    CreateThread( 
        NULL,                   // default security attributes
        0,                      // use default stack size  
        glRender,               // thread function name
        NULL,                   // argument to thread function 
        0,                      // use default creation flags 
        &thread_id);            // returns the thread identifier               
#endif

我可能在Win实现方面做错了

#elif defined(WINDOWS)
DWORD WINAPI glRender( void *ptr ) 

0 个答案:

没有答案