[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: how to create thread to exec member fn of a class



Hi,
Try making the member function static.

----- Original Message -----
From: Gaurav Priyolkar <pgaurav@xxxxxxxxxxxxxx>
To: <linux-india-programmers@xxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, October 21, 2000 6:50 AM
Subject: [LIP] how to create thread to exec member fn of a class


> Hi all,
>
> Is it possible to create a thread to execute the member function of a
class?
>
> pthread_create(&tid, NULL, A.x, (void*) arg);
>
> on compilation results in the warning:
>
> warning: converting from 'void*(A::*)(void*)' to 'void*(*)(void*)'
>
> Although the program runs and thread is created, how to get rid of this
> warning?
>
> Summing up, how to type cast a pointer to a member function of a
> class to a pointer to a global function?
>
> -Gaurav.
>
>
>
> ---------------------------------------------
> LIP is all for free speech.  But it was created
> for a purpose.  Violations of the rules of
> this list will result in stern action.