Use a member function for threading

by ixmx


#include <process.h>
 
class CMyWindow
{
public:
	static void thread_entry(void * p_userdata)
	{
		CMyWindow * p_win = static_cast<CMyWindow*> (p_userdata);
		p_win->message_loop(); 
	}
private:
	void message_loop()
	{
		.....
	}
};
 
.....
CMyWindow win;
_beginthread( &CMyWindow::thread_entry, 0, &win);
 
Advertisements