How can I pass boost::shared_ptr as a pointer to a Windows Thread function ? assume following code :
test::start()
{
....
_beginthreadex( NULL, 0, &test::threadRun, &shared_from_this(), 0, &threadID );
...
...
}
/*this is a static function*/
UINT __stdcall test::threadRun( LPVOID lpParam )
{
shared_ptr<test> k = *static_cast< shared_ptr<test>* >(lpParam);
...
}
I think this code is incorrect, what is your idea ? how can I do this ?
EDIT : I solved my problem by boost::weak_ptr. check my own answer in this page
I solved my problem by boost::weak_ptr: