1 #ifndef BOOST_THREAD_ONCE_HPP
2 #define BOOST_THREAD_ONCE_HPP
3 
4 //  once.hpp
5 //
6 //  (C) Copyright 2006-7 Anthony Williams
7 //
8 //  Distributed under the Boost Software License, Version 1.0. (See
9 //  accompanying file LICENSE_1_0.txt or copy at
10 //  http://www.boost.org/LICENSE_1_0.txt)
11 
12 #include <boost/thread/detail/config.hpp>
13 
14 #ifdef BOOST_MSVC
15 # pragma warning(push)
16 # pragma warning(disable: 4702) // unreachable code
17 #endif
18 
19 #include <boost/thread/detail/platform.hpp>
20 #if defined(BOOST_THREAD_PLATFORM_WIN32)
21 #include <boost/thread/win32/once.hpp>
22 #elif defined(BOOST_THREAD_PLATFORM_PTHREAD)
23 #if defined BOOST_THREAD_ONCE_FAST_EPOCH
24 #include <boost/thread/pthread/once.hpp>
25 #elif defined BOOST_THREAD_ONCE_ATOMIC
26 #include <boost/thread/pthread/once_atomic.hpp>
27 #else
28 #error "Once Not Implemented"
29 #endif
30 #else
31 #error "Boost threads unavailable on this platform"
32 #endif
33 
34 #include <boost/config/abi_prefix.hpp>
35 
36 namespace boost
37 {
38   // template<class Callable, class ...Args> void
39   // call_once(once_flag& flag, Callable&& func, Args&&... args);
40 template<typename Function>
call_once(Function func,once_flag & flag)41 inline void call_once(Function func,once_flag& flag)
42 //inline void call_once(void (*func)(),once_flag& flag)
43     {
44         call_once(flag,func);
45     }
46 }
47 
48 #include <boost/config/abi_suffix.hpp>
49 
50 #ifdef BOOST_MSVC
51 # pragma warning(pop)
52 #endif
53 
54 #endif
55