by Martin York <Martin.YorkAmazon@[EMAIL PROTECTED]
>
Apr 24, 2008 at 01:05 AM
> int main(){
>
> pthread_t mythreads[N]; //N integer > 1
> int ids[N];
>
> for (int j = 0; j < N; j++)
> ids[j] = pthread_create(&mythreads[j], NULL, /* the problem is
> here*/);
The problem is pthreads is a C library and does not know anything
about objects or methods etc. So you need to write a C bridge
function.
extern "C" void* thread_start(void* data);
void* my_thread_start(void* data)
{
Q* object = reinterpret_cast<Q*>(data);
object->gg(<ARGS>);
}
int main()
{
.... stuff ...
Q myQ;
.... stuff ...
ids[j] = pthread_create(&mythreads[j],
NULL,my_thread_start,&myQ);
.... stuff ...
}
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]