Problem in type conversion in pthread_create

Abhijit Tendulkar artendulkar at yahoo.com
Fri Jun 10 09:45:21 UTC 2005


Hello,

I'm new to this list, this is my first post.

I'm getting the type conversion error in my program.
I tried it in following way.

This is the function in which threads are to be
created:

void MonteCarlo :: generateEnrmap(vector<string> vstr,
int ns, float svdw, float er)
{
        arg ar, *arptr;
        //void *arptr;
        void *ptr;
        pthread_t id;
        int mid = _pgrmap.size() / 2;
        ar.vstr = vstr;
        ar.ns = ns;
        ar.svdw = svdw;
        ar.er = er;
        ar.mid = mid;
        //arptr = &ar;
        ptr = &ar; //arptr;
        if( 0 == pthread_create(&id, NULL,
generateEnrmap1, ptr) ) //Line No. 416
                cout<<"First thread created.\n";
        if( 0 == pthread_create(&id, NULL,
generateEnrmap2, ptr) ) //Line No. 418
                cout<<"Second thread created.\n";
        pthread_exit(NULL);
}

These are prototypes of two functions used in threads.
void * MonteCarlo :: generateEnrmap1(void *ptr)
void * MonteCarlo :: generateEnrmap2(void *ptr)

The only error I'm getting is as follows.

-bash-2.05b$ make
g++  -c -lpthread source/MonteCarlo.cc -Iheader
source/MonteCarlo.cc: In member function `void
   MonteCarlo::generateEnrmap(std::vector<std::string,
   std::allocator<std::string> >, int, float, float)':
source/MonteCarlo.cc:416: error: argument of type
`void*(MonteCarlo::)(void*)'
   does not match `void*(*)(void*)'
source/MonteCarlo.cc:418: error: argument of type
`void*(MonteCarlo::)(void*)'
   does not match `void*(*)(void*)'
make: *** [MonteCarlo.o] Error 1
-bash-2.05b$

Can anybody please help me in removing this error?
why this error message is showing one more * in
bracket?

Waiting for reply.

Thanks & regards.

Abhijit


		
__________________________________ 
Discover Yahoo! 
Stay in touch with email, IM, photo sharing and more. Check it out! 
http://discover.yahoo.com/stayintouch.html



More information about the c++-pthreads mailing list