File indexing completed on 2025-01-18 09:30:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_USER_EVENT_HPP
0012 #define BOOST_COMPUTE_USER_EVENT_HPP
0013
0014 #include <boost/compute/event.hpp>
0015 #include <boost/compute/context.hpp>
0016
0017 namespace boost {
0018 namespace compute {
0019
0020 #if defined(BOOST_COMPUTE_CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
0021
0022
0023
0024
0025
0026
0027 class user_event : public event
0028 {
0029 public:
0030
0031
0032
0033 explicit user_event(const context &context)
0034 {
0035 cl_int error;
0036 m_event = clCreateUserEvent(context.get(), &error);
0037 if(!m_event){
0038 BOOST_THROW_EXCEPTION(opencl_error(error));
0039 }
0040 }
0041
0042
0043 user_event(const user_event &other)
0044 : event(other)
0045 {
0046 }
0047
0048
0049 user_event& operator=(const user_event &other)
0050 {
0051 event::operator=(other);
0052
0053 return *this;
0054 }
0055
0056 #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES
0057
0058 user_event(user_event&& other) BOOST_NOEXCEPT
0059 : event(std::move(other))
0060 {
0061 }
0062
0063
0064 user_event& operator=(user_event&& other) BOOST_NOEXCEPT
0065 {
0066 event::operator=(std::move(other));
0067
0068 return *this;
0069 }
0070 #endif
0071
0072
0073
0074
0075 void set_status(cl_int execution_status)
0076 {
0077 cl_int ret = clSetUserEventStatus(m_event, execution_status);
0078 if(ret != CL_SUCCESS){
0079 BOOST_THROW_EXCEPTION(opencl_error(ret));
0080 }
0081 }
0082 };
0083 #endif
0084
0085 }
0086 }
0087
0088 #endif