By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,513 Members | 1,815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,513 IT Pros & Developers. It's quick & easy.

This pointer qustion!

P: 42
Guys,

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

Expand|Select|Wrap|Line Numbers
  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??

Thanks,

Amir.
May 27 '07 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
pthread_create() requires the address of a function with a void* argument that returns a void*:

Expand|Select|Wrap|Line Numbers
  1. void*  (*MyFunction)(void*);
  2.  
So write a function:

Expand|Select|Wrap|Line Numbers
  1. void* ATest(void*)
  2. {
  3.     /*call your class static function here */
  4. }
  5.  
and use ATest on the pthread_create() call.
May 28 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.