Re: creating thread in C++
- From: Ian Collins <ian-news@xxxxxxxxxxx>
- Date: Wed, 23 Jan 2008 21:38:44 +1300
mthread wrote:
On Dec 26 2007, 11:24 pm, Marcel Müller <news.5.ma...@xxxxxxxxxxxxxxx>
wrote:
...
myclass* m = new myclass();
_beginthread(&myclass::threadstub, NULL, 0, m);
This is defined behaviour as long as you always pass a non-NULL pointer
to myclass together with the function pointer &myclass::threadstub to
_beginthread.
Because there are some object lifetime issues and so on, there are
libraries like boost::thread that make your life easier. You should
think about using them.
Marcel
Hi thanx,
I am able to create thread now. I have used a static function. Can
u tell me how to use the free function
to create thread.
You shouldn't really do that, a static member function does not have
required extern "C" linkage.
One simple solution is the changer your static member to a friend
function and declare it (before the class definition) extern "C".
--
Ian Collins.
.
- Follow-Ups:
- Re: creating thread in C++
- From: mthread
- Re: creating thread in C++
- References:
- Re: creating thread in C++
- From: mthread
- Re: creating thread in C++
- Prev by Date: Re: creating thread in C++
- Next by Date: Re: Patent status of Proxy Collector?
- Previous by thread: Re: creating thread in C++
- Next by thread: Re: creating thread in C++
- Index(es):
Relevant Pages
|
Loading