Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 505701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:37:31+00:00 2026-05-13T06:37:31+00:00

what the difference when the number of threads is determined, as e.g.: for (i*10){

  • 0

what the difference when the number of threads is determined, as e.g.:

for (i*10){   
    ...   
    pthread_create(&thread[i], NULL, ThreadMain[i], (void *) xxx);   
    ...
}

and when it is undetermined, just like this:

    ...  
    pthread_create(&threadID, NULL, ThreadMain, (void *) xxx);   
    ...

In my case the number i can varry from 1 to 10. If e.g. I use the first method, I need to create 10times as e.g.:

void *ThreadMain1(void *xxx)
{  
    ...  
}  

until …

void *ThreadMain10(void *xxx)
{  
    ...  
}   

But if I use the second method, I need to create just :

void *ThreadMain(void *xxx)
{  
    ...  
} 

So which one is correct?

Thanks for your time and replies,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:37:31+00:00Added an answer on May 13, 2026 at 6:37 am

    If the threads are doing the same tasks, they should use the same function (with different input maybe), so one ThreadMain is the correct way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery's form plugin (as suggested in a number of threads like this
Is there any performance difference in my application if I change the number of
I'm doing some number crunching in C++, and I'm seeing a vast difference in
I'm looking for a way to find the number of hours of difference between
Will it be a big difference between this two scenarious: one instance of application
What is the difference between: new Thread(new ThreadStart(SomeFunc)) and: new Thread( delegate() { SomeFunc();}
To resolve this issue I have created an open source Java Thread Affinity library
All, I cannot find any threads where this issue has been brought up before,
How can I calculate the number of differences between two NSStrings. Example: NSString 1
I have code to calculate the percentage difference between 2 numbers - (oldNum -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.