Opened 9 years ago

Closed 9 years ago

#8513 closed Feature Requests (fixed)

Async: Add a basic thread_pool executor.

Reported by: viboes Owned by: viboes
Milestone: Boost 1.56.0 Component: thread
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

that could have this interface

  class thread_pool
  {

  public:
    BOOST_THREAD_NO_COPYABLE(thread_pool)

    /**
     * Effects: creates a thread pool that runs closures on @c thread_count threads.
     */
    thread_pool(unsigned const thread_count = thread_t::hardware_concurrency());
    /**
     * Effects: Destroys the thread pool.
     * Synchronization: The completion of all the closures happen before the completion of the thread pool destructor.
     */
    ~thread_pool();

    /**
     * Effects: close the thread_pool for submissions. The worker threads will work until
     */
    void close();

    /**
     * Returns: whether the pool is closed for submissions.
     */
    bool is_close();

    /**
     * Effects: The specified function will be scheduled for execution at some point in the future.
     * If invoking closure throws an exception the thread pool will call std::terminate, as is the case with threads.
     * Synchronization: completion of closure on a particular thread happens before destruction of thread's thread local variables.
     * Throws: sync_queue_is_closed if the thread pool is closed.
     *
     */
    template <typename Closure>
    void submit(BOOST_THREAD_RV_REFClousure) closure);

    /**
     * This must be called from an scheduled task.
     * Effects: reschedule functions until pred()
     */
    template <typename Pred>
    void reschedule_until(Pred const& pred);
  };

Change History (4)

comment:1 by viboes, 9 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:2 by viboes, 9 years ago

Summary: Add a basic thread_pool executor.Async: Add a basic thread_pool executor.

comment:3 by viboes, 9 years ago

Milestone: To Be DeterminedBoost 1.56.0

Committed revision [85855],[85863].

Last edited 9 years ago by viboes (previous) (diff)
Note: See TracTickets for help on using tickets.