LLVM 17.0.0git
Classes | Public Member Functions | List of all members
llvm::TaskQueue Class Reference

TaskQueue executes serialized work on a user-defined Thread Pool. More...

#include "llvm/Support/TaskQueue.h"

Public Member Functions

 TaskQueue (ThreadPool &Scheduler)
 Construct a task queue with no work.
 
 ~TaskQueue ()
 Blocking destructor: the queue will wait for all work to complete.
 
template<typename Callable >
std::future< std::invoke_result_t< Callable > > async (Callable &&C)
 Asynchronous submission of a task to the queue.
 

Detailed Description

TaskQueue executes serialized work on a user-defined Thread Pool.

It guarantees that if task B is enqueued after task A, task B begins after task A completes and there is no overlap between the two.

Definition at line 34 of file TaskQueue.h.

Constructor & Destructor Documentation

◆ TaskQueue()

llvm::TaskQueue::TaskQueue ( ThreadPool Scheduler)
inline

Construct a task queue with no work.

Definition at line 69 of file TaskQueue.h.

References Scheduler.

◆ ~TaskQueue()

llvm::TaskQueue::~TaskQueue ( )
inline

Blocking destructor: the queue will wait for all work to complete.

Definition at line 72 of file TaskQueue.h.

References assert(), and llvm::ThreadPool::wait().

Member Function Documentation

◆ async()

template<typename Callable >
std::future< std::invoke_result_t< Callable > > llvm::TaskQueue::async ( Callable &&  C)
inline

Asynchronous submission of a task to the queue.

The returned future can be used to wait for the task (and all previous tasks that have not yet completed) to finish.

Definition at line 81 of file TaskQueue.h.

References llvm::ThreadPool::async(), llvm::CallingConv::C, and F.


The documentation for this class was generated from the following file: