pthread

pthread

Post by sportvet » Sat, 19 Jul 2003 01:51:20



I am trying to spawn a thread that is a member function:

pthread_create(&thread, NULL, (void*)&CLASSNAME::functionname, NULL);

I am getting this error message:
converting from 'void (CLASSNAME::*)()' to 'void *'
ANSI C++ forbids implicit conversion from 'void*' in argument passing

any help would be appreciated.

Thanks,
Mark Fleureton

 
 
 

1. solaris 2.5 pthreads vs. pthreads

Is it known whether Sun's pthread implementation adheres to the standard?

Specifically, I am trying to port the public domain DCE RPC stuff to
solaris.  It is based on
an implementation of pthreads that seems to be a little different.  In most
cases it is
merely a matter of passing pointers rather than values, or passing a
parameter rather
than getting a value through the return.

But, there are two points where I'm not sure if I am porting this
correctly.

First, the code has a call to
        int pthread_setasynccancel(int state)

Which doesn't seem to exist under solaris.  There is, though a

        int pthread_setcancelstate(int newsate, int * oldstate)

The problem is that I don't see that the type is set to
PTHREAD_CANCEL_ASYNCHRONOUS.

So, is the solution to take a call that was

        oldstate = pthread_setasynccancel(newstate);

and make it

        retval = pthread_setcancelstate(newstate, &oldstate);

or is it

        retval = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
        retval = pthread_setcancelstate(newstate /* like PTHREAD_CANCEL_ENABLED
*/, &oldstate);

??

The second thing is related.  The code has a call to

        int pthread_setcancel(state);   /* which seems to be for non-asynchronous
cancels */

Again, solaris has no direct equivalent.  So, does

        oldstate = pthread_setcancel(state);

become

        retval = pthread_setcancelstate(newstate, &oldstate);

or

        retval = pthread_setcanceltype(PTHREAD_CANCEL_DEFFERED, &oldtype);
        retval = pthread_setcancelstate(newstate, &oldstate);

Any ideas?

Thanks,
-brennan

+===========================================================================
====+
+ Brennan HIldebrand
+ Senior Architect
+ CoSite, Inc

+===========================================================================
====+

2. File Pointers

3. Problem with pthread and clone() + pthread and context switching question...

4. Network adapter is recognized, but doesn't run, cause "network cable unplugged"

5. solaris threads,pthreads & MIT pthreads

6. Bad CRC returned? Help please!

7. Why doesn't a thread exit in pthreads-win32 version? (C++ / pthreads / pthreads-win32)

8. Burned audio cds

9. How can I send the conditional variable from one pthread to the other pthread in Linux C++ codes?

10. The implementation of condition variables in pthreads-win32

11. pthreads and (POSIX) timers

12. Catching C++ exceptions with pthreads

13. Killing a specific pthread guaranteed?