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

  • SEARCH
  • Home
  • 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 6349113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:33:06+00:00 2026-05-24T21:33:06+00:00

I have list with 1000-10000 jobs. It’s stored in simple char array. I need

  • 0

I have list with 1000-10000 jobs. It’s stored in simple char array. I need to finish work on the list as fast as i can.

I want to run 10 threads at any time. How i have to run new thread immediately (or almost immediately) after previous thread is done?

#define THREADS_LIMIT 10
const char * const jobs[]= { "data1", .... }
...
for (i = 0; i < THREADS_LIMIT; ++i)
{
// run first 10 threads
}

How can i start thread after previous is done ? I can run 10 threads, then wait until ALL of the is done, and then run next 10. But is there more efficient way ?

  • 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-24T21:33:07+00:00Added an answer on May 24, 2026 at 9:33 pm

    Don’t stop any threads. Simply have each thread move on to the next job instead of destroying it and creating a new one; they terminate when no more work remains. Now your main routine just starts THREAD_LIMIT threads, then pthread_joins them all.

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

Sidebar

Related Questions

I have say list of 1000 beans which I need to share among different
Let's say I have a list of arbitrary length, L: L = list(range(1000)) What
I have a list containing about 1000 file names to search under a directory
Say we have a list of integers from 0 to 1000: [0, 1, 2,
I have a list with these values: ['1', '10', '100.3', '1000.4', '1000.42', '150', '200',
i have a list like this [peter,1000,michell,2000,kelly,3000] and i would like to convert to
Suppose I have a List<T> with 1000 items in it. I'm then passing this
I have a dictionary that I've converted to a list so I can sort
I have a List with over 1000 unique entries and I want to form
I have a list of 1000 session ids. the session-id lengths are of 32

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.