...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::compute::wait_list — Stores a list of events.
// In header: <boost/compute/utility/wait_list.hpp> class wait_list { public: // types typedef std::vector< event >::iterator iterator; typedef std::vector< event >::const_iterator const_iterator; // construct/copy/destruct wait_list(); wait_list(const event &); wait_list(const wait_list &); wait_list(std::initializer_list< event >); wait_list(wait_list &&); wait_list & operator=(const wait_list &); wait_list & operator=(wait_list &&); ~wait_list(); // public member functions bool empty() const; uint_ size() const; void clear(); const cl_event * get_event_ptr() const; void reserve(size_t); void insert(const event &); template<typename T> void insert(const future< T > &); void wait() const; const event & operator[](size_t) const; event & operator[](size_t); iterator begin(); const_iterator begin() const; const_iterator cbegin() const; iterator end(); const_iterator end() const; const_iterator cend() const; };
The wait_list class stores a set of event objects and can be used to specify dependencies for OpenCL operations or to wait on the host until all of the events have completed.
This class also provides convenience functions for interacting with OpenCL APIs which typically accept event dependencies as a cl_event*
pointer and a cl_uint
size. For example:
wait_list events = ...; clEnqueueNDRangeKernel(..., events.get_event_ptr(), events.size(), ...);
See Also:
event, future<T>
wait_list
public
construct/copy/destructwait_list();Creates an empty wait-list.
wait_list(const event & event);Creates a wait-list containing
event
. wait_list(const wait_list & other);Creates a new wait-list as a copy of
other
. wait_list(std::initializer_list< event > events);Creates a wait-list from
events
. wait_list(wait_list && other);Move-constructs a new wait list object from
other
. wait_list & operator=(const wait_list & other);Copies the events in the wait-list from
other
. wait_list & operator=(wait_list && other);Move-assigns the wait list from
other
to *this
. ~wait_list();Destroys the wait-list.
wait_list
public member functionsbool empty() const;Returns
true
if the wait-list is empty. uint_ size() const;Returns the number of events in the wait-list.
void clear();Removes all of the events from the wait-list.
const cl_event * get_event_ptr() const;
Returns a cl_event pointer to the first event in the wait-list. Returns 0
if the wait-list is empty.
This can be used to pass the wait-list to OpenCL functions which expect a cl_event
pointer to refer to a list of events.
void reserve(size_t new_capacity);Reserves a minimum length of storage for the wait list object.
void insert(const event & event);Inserts
event
into the wait-list. template<typename T> void insert(const future< T > & future);Inserts the event from
future
into the wait-list. void wait() const;
Blocks until all of the events in the wait-list have completed.
Does nothing if the wait-list is empty.
const event & operator[](size_t pos) const;Returns a reference to the event at specified location
pos
. event & operator[](size_t pos);Returns a reference to the event at specified location
pos
. iterator begin();Returns an iterator to the first element of the wait-list.
const_iterator begin() const;Returns an iterator to the first element of the wait-list.
const_iterator cbegin() const;Returns an iterator to the first element of the wait-list.
iterator end();Returns an iterator to the element following the last element of the wait-list.
const_iterator end() const;Returns an iterator to the element following the last element of the wait-list.
const_iterator cend() const;Returns an iterator to the element following the last element of the wait-list.