LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-09-2009, 05:00 AM   #1
nathan
LQ Newbie
 
Registered: Aug 2009
Location: california
Distribution: fedora
Posts: 21

Rep: Reputation: 15
warning in pthread creation


void * func1( void); // prototype

void * func1( void)
{

..
...
}

int main()
{
int ret;
pthread_t test1;

ret = pthread_create(&test1,NULL,&func1,NULL);
if(ret == 0)
{
printf("\n success in creating a thread \n");
}

pthread_exit(NULL);
return 0;
}


after compiling the above code i am gettin following warning,

thread_1.c:805: warning: passing arg 3 of `pthread_create' from incompatible pointer type

kindly resolve the same

thanks in advance
Nathan
 
Old 09-09-2009, 06:49 AM   #2
hyperactive22
LQ Newbie
 
Registered: May 2007
Posts: 8

Rep: Reputation: 0
The prototype of pthread_create is:
int pthread_create(pthread_t *restrict thread,const pthread_attr_t *restrict attr,void *(*start_routine)(void*), void *restrict arg);
which means that the method u are passing as param to pthread_create should have following prototype:
void * method_name (void*) ;
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
System user creation with mysql user creation moos3 Programming 1 08-11-2007 08:01 PM
libtest.a uses pthread: user of libtest.a should not link pthread again debulu Programming 2 01-31-2007 09:23 PM
pthread Creation failing arunka Programming 1 07-18-2006 12:34 PM
pthread creation problem oulevon Programming 2 04-24-2006 04:59 AM
pthread and C++ gt73 Programming 17 11-04-2003 03:01 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration