开发者

How to do "pthread" under windows? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have tried:

1) POSIX Threads for Win32, myfiles1

What I did was copying the files in “lib” and “include” folders form the "Pre-built.2" directory to my project directory, and add this line to mapping.cpp

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

2) and this tutorial, myfiles2

But I couldn't figure out how to change this part:

#if de开发者_如何学运维fined(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

I probably have done something wrong with the Win implementation

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜