?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/async.zip
???????
PK 9�!\�.̎ � future.hppnu �[��� //---------------------------------------------------------------------------// // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com> // // Distributed under the Boost Software License, Version 1.0 // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt // // See http://boostorg.github.com/compute for more information. //---------------------------------------------------------------------------// #ifndef BOOST_COMPUTE_ASYNC_FUTURE_HPP #define BOOST_COMPUTE_ASYNC_FUTURE_HPP #include <boost/compute/event.hpp> namespace boost { namespace compute { /// \class future /// \brief Holds the result of an asynchronous computation. /// /// \see event, wait_list template<class T> class future { public: future() : m_event(0) { } future(const T &result, const event &event) : m_result(result), m_event(event) { } future(const future<T> &other) : m_result(other.m_result), m_event(other.m_event) { } future& operator=(const future<T> &other) { if(this != &other){ m_result = other.m_result; m_event = other.m_event; } return *this; } ~future() { } /// Returns the result of the computation. This will block until /// the result is ready. T get() { wait(); return m_result; } /// Returns \c true if the future is valid. bool valid() const { return m_event != 0; } /// Blocks until the computation is complete. void wait() const { m_event.wait(); } /// Returns the underlying event object. event get_event() const { return m_event; } #if defined(BOOST_COMPUTE_CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) /// Invokes a generic callback function once the future is ready. /// /// The function specified by callback must be invokable with zero arguments. /// /// \see_opencl_ref{clSetEventCallback} /// \opencl_version_warning{1,1} template<class Function> future& then(Function callback) { m_event.set_callback(callback); return *this; } #endif // BOOST_COMPUTE_CL_VERSION_1_1 private: T m_result; event m_event; }; /// \internal_ template<> class future<void> { public: future() : m_event(0) { } template<class T> future(const future<T> &other) : m_event(other.get_event()) { } explicit future(const event &event) : m_event(event) { } template<class T> future<void> &operator=(const future<T> &other) { m_event = other.get_event(); return *this; } future<void> &operator=(const future<void> &other) { if(this != &other){ m_event = other.m_event; } return *this; } ~future() { } void get() { wait(); } bool valid() const { return m_event != 0; } void wait() const { m_event.wait(); } event get_event() const { return m_event; } #if defined(BOOST_COMPUTE_CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) /// Invokes a generic callback function once the future is ready. /// /// The function specified by callback must be invokable with zero arguments. /// /// \see_opencl_ref{clSetEventCallback} /// \opencl_version_warning{1,1} template<class Function> future<void> &then(Function callback) { m_event.set_callback(callback); return *this; } #endif // BOOST_COMPUTE_CL_VERSION_1_1 private: event m_event; }; /// \internal_ template<class Result> inline future<Result> make_future(const Result &result, const event &event) { return future<Result>(result, event); } } // end compute namespace } // end boost namespace #endif // BOOST_COMPUTE_ASYNC_FUTURE_HPP PK 9�!\E���F F wait_guard.hppnu �[��� //---------------------------------------------------------------------------// // Copyright (c) 2013-2015 Kyle Lutz <kyle.r.lutz@gmail.com> // // Distributed under the Boost Software License, Version 1.0 // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt // // See http://boostorg.github.com/compute for more information. //---------------------------------------------------------------------------// #ifndef BOOST_COMPUTE_ASYNC_WAIT_GUARD_HPP #define BOOST_COMPUTE_ASYNC_WAIT_GUARD_HPP #include <boost/noncopyable.hpp> namespace boost { namespace compute { /// \class wait_guard /// \brief A guard object for synchronizing an operation on the device /// /// The wait_guard class stores a waitable object representing an operation /// on a compute device (e.g. \ref event, \ref future "future<T>") and calls /// its \c wait() method when the guard object goes out of scope. /// /// This is useful for ensuring that an OpenCL operation completes before /// leaving the current scope and cleaning up any resources. /// /// For example: /// \code /// // enqueue a compute kernel for execution /// event e = queue.enqueue_nd_range_kernel(...); /// /// // call e.wait() upon exiting the current scope /// wait_guard<event> guard(e); /// \endcode /// /// \ref wait_list, wait_for_all() template<class Waitable> class wait_guard : boost::noncopyable { public: /// Creates a new wait_guard object for \p waitable. wait_guard(const Waitable &waitable) : m_waitable(waitable) { } /// Destroys the wait_guard object. The default implementation will call /// \c wait() on the stored waitable object. ~wait_guard() { m_waitable.wait(); } private: Waitable m_waitable; }; } // end compute namespace } // end boost namespace #endif // BOOST_COMPUTE_ASYNC_WAIT_GUARD_HPP PK 9�!\-�J�t t wait.hppnu �[��� //---------------------------------------------------------------------------// // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com> // // Distributed under the Boost Software License, Version 1.0 // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt // // See http://boostorg.github.com/compute for more information. //---------------------------------------------------------------------------// #ifndef BOOST_COMPUTE_ASYNC_WAIT_HPP #define BOOST_COMPUTE_ASYNC_WAIT_HPP #include <boost/compute/config.hpp> #include <boost/compute/utility/wait_list.hpp> namespace boost { namespace compute { namespace detail { #ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES template<class Event> inline void insert_events_variadic(wait_list &l, Event&& event) { l.insert(std::forward<Event>(event)); } template<class Event, class... Rest> inline void insert_events_variadic(wait_list &l, Event&& event, Rest&&... rest) { l.insert(std::forward<Event>(event)); insert_events_variadic(l, std::forward<Rest>(rest)...); } #endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES } // end detail namespace #ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES /// Blocks until all events have completed. Events can either be \ref event /// objects or \ref future "future<T>" objects. /// /// \see event, wait_list template<class... Events> inline void wait_for_all(Events&&... events) { wait_list l; detail::insert_events_variadic(l, std::forward<Events>(events)...); l.wait(); } #endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES } // end compute namespace } // end boost namespace #endif // BOOST_COMPUTE_ASYNC_WAIT_HPP PK 9�!\�.̎ � future.hppnu �[��� PK 9�!\E���F F � wait_guard.hppnu �[��� PK 9�!\-�J�t t L wait.hppnu �[��� PK � �
| ver. 1.6 |
Github
|
.
| PHP 8.2.30 | ??????????? ?????????: 0 |
proxy
|
phpinfo
|
???????????