Boost.UI
User Interface Boost library
thread.hpp
Go to the documentation of this file.
1 // Copyright (c) 2017 Kolya Kosenko
2 
3 // Distributed under the Boost Software License, Version 1.0.
4 // See http://www.boost.org/LICENSE_1_0.txt
5 
7 
8 #ifndef BOOST_UI_THREAD_HPP
9 #define BOOST_UI_THREAD_HPP
10 
11 #include <boost/ui/config.hpp>
12 
13 #ifdef BOOST_HAS_PRAGMA_ONCE
14 #pragma once
15 #endif
16 
17 #include <boost/function.hpp>
18 
19 #ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
20 #include <boost/move/utility.hpp> // boost::forward()
21 #endif
22 
23 namespace boost {
24 namespace ui {
25 
26 #ifndef DOXYGEN
27 
28 namespace detail {
29 BOOST_UI_DECL void call_async(const boost::function<void()>& fn);
30 } // namespace detail
31 
32 #endif
33 
37 
38 #ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
39 template <class F, class ...Args>
40 void call_async(F&& f, Args&&... args)
41 {
42  detail::call_async(std::bind(boost::forward<F>(f), boost::forward<Args>(args)...));
43 }
44 #else
45 inline void call_async(const boost::function<void()>& fn)
46 {
48 }
49 #endif
50 
51 
52 } // namespace ui
53 } // namespace boost
54 
55 #endif // BOOST_UI_THREAD_HPP
config.hpp
Configuration options.
boost
Boost C++ libraries namespace.
Definition: window.hpp:19
boost::ui::call_async
void call_async(F &&f, Args &&... args)
Calls f in the idle time in UI thread. This function is thread safe.
Definition: thread.hpp:40