I'm trying to bind a member function as a Win32 thread function type so I can pass it to CreateThread. From what I understand from the boost.bind doc, it should be done like this:
struct MsThread {
DWORD WINAPI Mediary(LPVOID);
DWORD _threadId;
};
MsThread thread;
CreateThread(NULL, 0, boost::bind< DWORD WINAPI >(&MsThread::Mediary, &thread, _1), 0, &thread._threadId);
However, it gives me errors. I'm using MinGW g++ 3.2.3 WinXP. Thanks for any help.
[edited by - dcosborn on January 27, 2004 8:18:46 AM]
CreateThread expects a plain C function pointer. boost::bind returns a boost::function object.
No cigar.
boost::thread will happily accept boost::function (and other) objects
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan (C programming language co-inventor)
With your permission, GameDev.net uses analytics cookies to understand how people use the platform.
You can accept analytics or continue with necessary cookies only.
Learn more