How to create thread from class’s method

This post is also available in: Russian

Sometimes I need start thread from class method. Compiler return error while compilation.

error C2664: ‘CreateThread’ : cannot convert parameter 3 from ‘unsigned long (__thiscall CMyClass::*)(void *)’ to ‘unsigned long (__stdcall *)(void *)’

Compiler is right. Static function address is needed to CreateThread. But If you start class method you want it should act as class instance method. This problem solves article from here ( in Russian ). Someone advices use boost for that. I believe no need add extra library to solve such a little problem.

Someone added this sample to “bad code samples collection” “bad code samples collection”. I think he don’t really understand context.