12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #ifndef BOOST_COMPUTE_USER_EVENT_HPP
- #define BOOST_COMPUTE_USER_EVENT_HPP
- #include <boost/compute/event.hpp>
- #include <boost/compute/context.hpp>
- namespace boost {
- namespace compute {
- #if defined(BOOST_COMPUTE_CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
- class user_event : public event
- {
- public:
-
-
-
- explicit user_event(const context &context)
- {
- cl_int error;
- m_event = clCreateUserEvent(context.get(), &error);
- if(!m_event){
- BOOST_THROW_EXCEPTION(opencl_error(error));
- }
- }
-
- user_event(const user_event &other)
- : event(other)
- {
- }
-
- user_event& operator=(const user_event &other)
- {
- event::operator=(other);
- return *this;
- }
- #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES
-
- user_event(user_event&& other) BOOST_NOEXCEPT
- : event(std::move(other))
- {
- }
-
- user_event& operator=(user_event&& other) BOOST_NOEXCEPT
- {
- event::operator=(std::move(other));
- return *this;
- }
- #endif
-
-
-
- void set_status(cl_int execution_status)
- {
- cl_int ret = clSetUserEventStatus(m_event, execution_status);
- if(ret != CL_SUCCESS){
- BOOST_THROW_EXCEPTION(opencl_error(ret));
- }
- }
- };
- #endif
- }
- }
- #endif
|