c++ - Passing arguments to _beginthread within class function -


i've been using _beginthread within (windows) c++ class create threads. have learned, use _beginthread , pass member function within class, there rather obtuse wrapping protocol has followed, example:

class myclass { public:     void fun_1()     {           _beginthread(&myclass::fun_2_wrapper, 0, static_cast<void*>(this));     }  private:     void fun_2()     {         printf("hello");       }        static void __cdecl fun_2_wrapper(void* o)     {         static_cast<myclass*>(o)->fun_2();     } }; 

i have been having trouble translating model 1 accepts arguments thread function. instance, if wanted thread function instead be:

void fun_2(int a) 

how adapt function calls? (note, trying accomplish without boost::thread or similar libraries project consistency)


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -