Re: This pointer question!
On May 30, 4:41 pm, Kirit S=E6lensminde <kirit.saelensmi...@gmail.com>
wrote:
On May 28, 4:07 pm, a...@parsonline.net wrote:
As you know static member functions do not have a this pointer. so
instead, what shall i do?
for example ... consider I want to call
Code: ( text )
1.
pthread_create(&thID,NULL,classA::B, (void *) this);
and it is called in an static method so instead of this what can I
put??
If you can you're much better off using Boost::threads for this.
It depends. The conception of Boost::threads is far from
perfect, and it's all to easy to accidentally get a detached
thread due to an unexpected exception. The advantages of
Boost::threads limit themselves to: 1) they've already wrapped
the system API, so you don't have to learn both Windows and
Posix, and worry about system dependant code yourself, and 2) in
cases where you want to view the new thread as a functional
object, with its own totally independant lifetime,
Boost::threads has already handled the copying and the
synchronization issues at thread start up for you. (2 is almost
always the case for detached threads, rarely however for
joinable threads.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34