[lug] pthreads, reprise

D. Stimits stimits at idcomm.com
Wed May 31 20:52:38 MDT 2000


Kevin King wrote:
> 
> Once again, my thanks to those who helped with the linker option for
> multithreaded C++ code.  Perhaps you would be willing to assist with another
> question?
> 
> Is it possible to invoke pthread_create(..) and pass the name of a class
> method?  I am having no problems passing the names of routines that are
> outside the class, but am unable to pass a class method name.  I am
> suspecting it has something to do with name decoration, but I have no idea
> how to make it work.
> 
> --Kevin
> kevin at precisonline.com
> http://www.precisonline.com
> http://www.precisonline.com/gold.htm
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug

Just guessing, I'd say that static functions should be directly
callable, but to use a non-static member, you'd be required to pass
"this->Function" instead of "MyClass::Function". The reasoning is that
although you can't directly call a member function of a class, you might
be able to do so with an instantiated object. Thus "this". For
pthread_create() to not choke, it is also possible that you'll be
required to use static_cast<> on "MyClass::Function" during the create,
telling it to consider this a pointer to a function, not a pointer to a
class internally offset to a function.




More information about the LUG mailing list