Silicium
boost_threading.hpp
Go to the documentation of this file.
1 #ifndef SILICIUM_BOOST_THREADING_HPP
2 #define SILICIUM_BOOST_THREADING_HPP
3 
4 #include <silicium/config.hpp>
5 #include <boost/thread/mutex.hpp>
6 #include <boost/thread/condition_variable.hpp>
7 #include <boost/thread/future.hpp>
8 
9 namespace Si
10 {
12  {
13 #if SILICIUM_HAS_EXCEPTIONS
14  template <class T>
15  struct future
16  {
17  typedef boost::unique_future<T> type;
18  };
19  template <class T>
20  struct promise
21  {
22  typedef boost::promise<T> type;
23  };
24  template <class Result>
25  struct packaged_task
26  {
27  typedef boost::packaged_task<Result
28 #ifdef BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK
29  ()
30 #endif
31  > type;
32  };
33 #endif
34  typedef boost::mutex mutex;
35  typedef boost::condition_variable condition_variable;
36  typedef boost::unique_lock<boost::mutex> unique_lock;
37 #if (BOOST_VERSION >= 105000) && SILICIUM_HAS_EXCEPTIONS
38  template <class Action, class ...Args>
39  static auto launch_async(Action &&action, Args &&...args) -> boost::unique_future<decltype(action(std::forward<Args>(args)...))>
40  {
41  return boost::async(boost::launch::async, std::forward<Action>(action), std::forward<Args>(args)...);
42  }
43 #endif
44  };
45 }
46 
47 #endif
boost::mutex mutex
Definition: boost_threading.hpp:34
Definition: absolute_path.hpp:19
boost::condition_variable condition_variable
Definition: boost_threading.hpp:35
Definition: boost_threading.hpp:11
boost::unique_lock< boost::mutex > unique_lock
Definition: boost_threading.hpp:36