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 8538355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:06:33+00:00 2026-06-11T11:06:33+00:00

I need to implement a thread pool executor for generic tasks. My idea is

  • 0

I need to implement a thread pool executor for generic tasks. My idea is to use OpenMP for thread management. The problem is that I’m not familar yet with OpenMP..

I tried to find an existing implementation of the generic ThreadPool with OpenMP, but I haven’t find one so far. What I would like to have in the end is something very similar to java.util.concurrent.ThreadPoolExecutor:

template <typename Return, typename Task>
class ThreadPoolExecutor
{
public:
    ThreadPoolExecutor(int threadCount);

    // asyncronous invoke
    boost::unique_future<Return> submit(const TaskPtr & task);

    // blocking call
    std::vector<Return> invokeAll(const std::vector<TaskPtr> & tasks)
    {
        // submit all tasks + wait for completion
        #pragma omp parallel default(shared)
        {
            // call tasks here
        }
    }
};

I have several questions about this approach:

  1. Is there existing implementation of thread pool with OpenMP for C++? [I know I can implement threadpool with boost::asio::io_service, but I would prefer not depend on it]

  2. With my design – how can we guarantee that the OpenMP threads will be ‘owned’ by the concrete ThreadPoolExecutor instance? They should not be static for all instances.

Thank you for any advice & constructive critics of this approach & proposals of other implementations.

  • 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-06-11T11:06:34+00:00Added an answer on June 11, 2026 at 11:06 am

    Just to sum up: as described in the comments OpenMP is not an option for implementing generic thread pool or executor, because:

    1. OpenMP is strictly a fork/join threading model.
    2. You can’t assign the owner for OpenMP threads
    3. No control over threads and internal threadpool
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to implement a thread pool using pthreads. I could not move forward.
I need to implement a thread pool in Java (java.util.concurrent) whose number of threads
I am trying to implement a thread pool that processes a task queue using
I am considering the use of potentially hundreds of threads to implement tasks that
I need to implement portable code, but I do not know how to deal
i need to implement a messaging scenario that consumes messages from throusands of destinations
I would like to implement a thread pool in Java, which can dynamically resize
I have a long running task that I need to implement on a webpage.
My process reads from a single queue tasks that need to be sent to
I am writing a program that utilizes a thread pool in order to search

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.