LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-26-2005, 11:26 AM   #1
os2
Member
 
Registered: Dec 2003
Location: Canada
Distribution: openSUSE Tumbleweed
Posts: 209

Rep: Reputation: 30
pthread_create...


hi

is there a way to pass 2 parameter to pthread_create?

Code:
typedef struct bproduction_s {
  ....
} bproduction_t;
bproduction_t bprod;
production_t prod;

i would like to do somelthing like: 

rc = pthread_create(&threads, NULL, (void *)&writeFile, (void *)&bprod;, (void *)&prod)
if (rc) {
    printf"**CRITICAL** return code from pthread_create() is %d\n", rc);
    exit(-1);
 }
thanks
 
Old 05-26-2005, 12:00 PM   #2
niknah
Member
 
Registered: Dec 2002
Location: In front of a computer
Distribution: UPS, DHL, FedEx
Posts: 466

Rep: Reputation: 38
nope, define a new struct and put them both into that one new struct and pass the new struct.
 
Old 05-26-2005, 12:14 PM   #3
os2
Member
 
Registered: Dec 2003
Location: Canada
Distribution: openSUSE Tumbleweed
Posts: 209

Original Poster
Rep: Reputation: 30
ok if write:

bproduction_t bprod[2];
that will be ok?
 
Old 05-26-2005, 12:20 PM   #4
niknah
Member
 
Registered: Dec 2002
Location: In front of a computer
Distribution: UPS, DHL, FedEx
Posts: 466

Rep: Reputation: 38
yes, should be ok. try it out
 
Old 05-26-2005, 03:09 PM   #5
os2
Member
 
Registered: Dec 2003
Location: Canada
Distribution: openSUSE Tumbleweed
Posts: 209

Original Poster
Rep: Reputation: 30
hi

somebody can confirm me that pthread_create that onle the first parameters of the function... and will be able to know if there are some other?

Code:
void
production(production_count_t *prod_cnt, tiny_xcs_t *xcs)
{
.......
} 

int main()
{
  tiny_xcs_t xcs;
  production_count_t prod_cnt;
  rc = pthread_create(&threads, NULL, (void *)&production, (void *)&prod_cnt);
  if (rc) {
      gmacc_syslog("**CRITICAL** return code from pthread_create() is %d\n", rc);
      exit(-1);
  }
}

thanks
 
  


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
error on pthread_create? adamjmac Programming 2 05-23-2005 06:21 PM
pthread_create problem live_dont_exist Programming 5 04-24-2005 06:21 AM
Pthread_create rahul_kulkarni Programming 4 02-10-2005 11:48 AM
pthread_create tushar123 Programming 2 06-07-2004 08:15 AM
pthread_create parameters AquamaN Programming 3 03-16-2004 10:05 AM

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

All times are GMT -5. The time now is 01:42 AM.

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