| Home | Libraries | People | FAQ | More

## Class wait_list

boost::compute::wait_list — Stores a list of events.

## Synopsis

    // 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;
    };

## Description

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/destruct

1.     wait_list();

   Creates an empty wait-list.

2.     wait_list(const event & event);

   Creates a wait-list containing `event`.

3.     wait_list(const wait_list & other);

   Creates a new wait-list as a copy of `other`.

4.     wait_list(std::initializer_list< event > events);

   Creates a wait-list from `events`.

5.     wait_list(wait_list && other);

   Move-constructs a new wait list object from `other`.

6.     wait_list & operator=(const wait_list & other);

   Copies the events in the wait-list from `other`.

7.     wait_list & operator=(wait_list && other);

   Move-assigns the wait list from `other` to `*this`.

8.     ~wait_list();

   Destroys the wait-list.

### `wait_list` public member functions

1.     bool empty() const;

   Returns `true` if the wait-list is empty.

2.     uint_ size() const;

   Returns the number of events in the wait-list.

3.     void clear();

   Removes all of the events from the wait-list.

4.     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.

5.     void reserve(size_t new_capacity);

   Reserves a minimum length of storage for the wait list object.

6.     void insert(const event & event);

   Inserts `event` into the wait-list.

7.     template<typename T> void insert(const future< T > & future);

   Inserts the event from `future` into the wait-list.

8.     void wait() const;

   Blocks until all of the events in the wait-list have completed.

   Does nothing if the wait-list is empty.

9.     const event & operator[](size_t pos) const;

   Returns a reference to the event at specified location `pos`.

10.     event & operator[](size_t pos);

    Returns a reference to the event at specified location `pos`.

11.     iterator begin();

    Returns an iterator to the first element of the wait-list.

12.     const_iterator begin() const;

    Returns an iterator to the first element of the wait-list.

13.     const_iterator cbegin() const;

    Returns an iterator to the first element of the wait-list.

14.     iterator end();

    Returns an iterator to the element following the last element of the wait-list.

15.     const_iterator end() const;

    Returns an iterator to the element following the last element of the wait-list.

16.     const_iterator cend() const;

    Returns an iterator to the element following the last element of the wait-list.