Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > pthread_create for class ?

Reply
Thread Tools

pthread_create for class ?

 
 
vertigo
Guest
Posts: n/a
 
      08-28-2004
Hello
I have class Node and function:
void Node::Start(void){
pthread_create(&ServerLoopThread,NULL,&Node::Start ServerLoop,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*(*)(vo id*))&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

 
Reply With Quote
 
 
 
 
vertigo
Guest
Posts: n/a
 
      08-28-2004


sorry, i've mistaken groups.

 
Reply With Quote
 
 
 
 
Paul Lutus
Guest
Posts: n/a
 
      08-28-2004
vertigo wrote:

> Hello
> I have class Node and function:
> void Node::Start(void){
> pthread_create(&ServerLoopThread,NULL,&Node::Start ServerLoop,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

 
Reply With Quote
 
zoopy
Guest
Posts: n/a
 
      08-29-2004
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.
 
Reply With Quote
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      08-29-2004
zoopy <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pthread_create returns error code 11 Joy C++ 1 05-27-2009 07:14 PM
pthread_create error Gary Wessle C++ 9 10-21-2006 10:33 PM
What is the problem with Pthread_create yezi C Programming 5 11-01-2005 09:08 PM
How to pass a class-member function to pthread_create(....)? Huskier@gmail.com C++ 12 07-17-2005 09:12 PM
Object Argument passing in pthread_create nightowl C++ 1 10-21-2004 03:18 PM



Advertisments