pthread_create for class ?

Discussion in 'Java' started by vertigo, Aug 28, 2004.

  1. vertigo

    vertigo Guest

    Hello
    I have class Node and function:
    void Node::Start(void){
    pthread_create(&ServerLoopThread,NULL,&Node::StartServerLoop,NULL);
    }

    void Node::StartServerLoop(void){
    ...
    }

    and durring compilation i receive error:
    Node.c: In member function `void Node::Start()':
    Node.c:21: error: cannot convert `void (Node::*)()' to `void*(*)(void*)'
    for
    argument `3' to `int pthread_create(pthread_t*, const pthread_attr_t*,
    void*(*)(void*), void*)'
    make: *** [Node.o] Error 1

    when i changed to:

    pthread_create(&ServerLoopThread,NULL,(void*(*)(void*))&Node::StartServerLoop,NULL);
    i receive error:
    Node.c: In member function `void Node::Start()':
    Node.c:20: error: converting from `void (Node::*)()' to `void*(*)(void*)'
    make: *** [Node.o] Error 1

    Why ?
    How can i correct it ?

    Thanx
    Michal
     
    vertigo, Aug 28, 2004
    #1
    1. Advertising

  2. vertigo

    vertigo Guest

    sorry, i've mistaken groups.
     
    vertigo, Aug 28, 2004
    #2
    1. Advertising

  3. vertigo

    Paul Lutus Guest

    vertigo wrote:

    > Hello
    > I have class Node and function:
    > void Node::Start(void){
    > pthread_create(&ServerLoopThread,NULL,&Node::StartServerLoop,NULL);
    > }
    >
    > void Node::StartServerLoop(void){



    This is not Java code. Did you just choose a newsgroup at random?

    > ...
    > }
    >
    > and durring compilation i receive error:
    > Node.c: In member function `void Node::Start()':
    > Node.c:21: error: cannot convert `void (Node::*)()' to `void*(*)(void*)'
    > for
    > argument `3' to `int pthread_create(pthread_t*, const pthread_attr_t*,
    > void*(*)(void*), void*)'
    > make: *** [Node.o] Error 1
    >
    > when i changed to:
    >
    > pthread_create(&ServerLoopThread,NULL,(void*(*

    (void*))&Node::StartServerLoop,NULL);
    > i receive error:
    > Node.c: In member function `void Node::Start()':
    > Node.c:20: error: converting from `void (Node::*)()' to `void*(*)(void*)'
    > make: *** [Node.o] Error 1
    >
    > Why ?
    > How can i correct it ?


    Well, you can start by posting to an appropriate newsgroup. Your code looks
    like C++. I think if you cannot identify which language you are coding in,
    it's going to be a long haul between this moment and a working program.

    --
    Paul Lutus
    http://www.arachnoid.com
     
    Paul Lutus, Aug 28, 2004
    #3
  4. vertigo

    zoopy Guest

    Re: [OT] pthread_create for class ?

    On 28-8-2004 11:53, Paul Lutus wrote:
    >
    >
    > I think if you cannot identify which language you are coding in,
    > it's going to be a long haul between this moment and a working program.
    >


    Yes, another nice comment. Keep them coming Paul, I like them.

    --
    Regards,
    Z.
     
    zoopy, Aug 29, 2004
    #4
  5. Re: [OT] pthread_create for class ?

    zoopy <> writes:

    > Yes, another nice comment. Keep them coming Paul, I like them.


    Stalking someone on Usenet is soo 1990s. Take up stamp collecting or
    something, already.
     
    Tor Iver Wilhelmsen, Aug 29, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nightowl
    Replies:
    1
    Views:
    2,223
    Ron Natalie
    Oct 21, 2004
  2. yezi

    What is the problem with Pthread_create

    yezi, Nov 1, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,083
    Emmanuel Delahaye
    Nov 1, 2005
  3. Replies:
    12
    Views:
    2,027
    verec
    Jul 17, 2005
  4. Gary Wessle

    pthread_create error

    Gary Wessle, Oct 21, 2006, in forum: C++
    Replies:
    9
    Views:
    1,081
    Larry Smith
    Oct 21, 2006
  5. Joy
    Replies:
    1
    Views:
    2,987
    Bart van Ingen Schenau
    May 27, 2009
Loading...

Share This Page