diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index 86f54c7..7795143 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 diff --git a/include/boost/function/threading/detail/mutex_mixin.hpp b/include/boost/function/threading/detail/mutex_mixin.hpp new file mode 100644 index 0000000..0bdb4a2 --- /dev/null +++ b/include/boost/function/threading/detail/mutex_mixin.hpp @@ -0,0 +1,48 @@ +// Copyright (C) 2002 +// Doug Gregor (gregod@cs.rpi.edu) +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appear in all copies and +// that both that copyright notice and this permission notice appear +// in supporting documentation. William E. Kempf makes no representations +// about the suitability of this software for any purpose. +// It is provided "as is" without express or implied warranty. +#ifndef BOOST_THREAD_MODEL_DETAIL_MUTEX_MIXIN_HPP +#define BOOST_THREAD_MODEL_DETAIL_MUTEX_MIXIN_HPP + +namespace boost { +namespace detail { + +template +class mutex_mixin +{ +public: + mutex_mixin(const mutex_mixin&) {} + mutex_mixin& operator=(const mutex_mixin&) { return *this; } + + operator const Mutex&() const { return mutex; } + operator Mutex&() { return mutex; } + +private: + Mutex mutex; +}; + +template +class static_mutex_mixin +{ +public: + static_mutex_mixin(const mutex_mixin&) {} + static_mutex_mixin& operator=(const mutex_mixin&) { return *this; } + + operator const Mutex&() const { return mutex; } + operator Mutex&() { return mutex; } + +private: + static Mutex mutex; +}; + +} // end namespace detail +} // end namespace boost + +#endif // BOOST_THREAD_MODEL_DETAIL_MUTEX_MIXIN_HPP diff --git a/include/boost/function/threading/per_class.hpp b/include/boost/function/threading/per_class.hpp new file mode 100644 index 0000000..7cebb5c --- /dev/null +++ b/include/boost/function/threading/per_class.hpp @@ -0,0 +1,28 @@ +// Copyright (C) 2002 +// Doug Gregor (gregod@cs.rpi.edu) +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appear in all copies and +// that both that copyright notice and this permission notice appear +// in supporting documentation. William E. Kempf makes no representations +// about the suitability of this software for any purpose. +// It is provided "as is" without express or implied warranty. +#ifndef BOOST_THREAD_MODEL_PER_CLASS_HPP +#define BOOST_THREAD_MODEL_PER_CLASS_HPP + +#include +#include + +namespace boost { + + template + struct per_class_locking + { + typedef detail::static_mutex_mixin mixin; + typedef typename Mutex::scoped_lock lock; + }; + +} // end namespace boost + +#endif // BOOST_THREAD_MODEL_PER_CLASS_HPP diff --git a/include/boost/function/threading/per_object.hpp b/include/boost/function/threading/per_object.hpp new file mode 100644 index 0000000..338cb7f --- /dev/null +++ b/include/boost/function/threading/per_object.hpp @@ -0,0 +1,28 @@ +// Copyright (C) 2002 +// Doug Gregor (gregod@cs.rpi.edu) +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appear in all copies and +// that both that copyright notice and this permission notice appear +// in supporting documentation. William E. Kempf makes no representations +// about the suitability of this software for any purpose. +// It is provided "as is" without express or implied warranty. +#ifndef BOOST_THREAD_MODEL_PER_OBJECT_HPP +#define BOOST_THREAD_MODEL_PER_OBJECT_HPP + +#include +#include + +namespace boost { + + template + struct per_object_locking + { + typedef detail::mutex_mixin mixin; + typedef typename Mutex::scoped_lock lock; + }; + +} // end namespace boost + +#endif // BOOST_THREAD_MODEL_PER_OBJECT_HPP diff --git a/include/boost/function/threading/single.hpp b/include/boost/function/threading/single.hpp new file mode 100644 index 0000000..c9724c1 --- /dev/null +++ b/include/boost/function/threading/single.hpp @@ -0,0 +1,27 @@ +// Copyright (C) 2002 +// Doug Gregor (gregod@cs.rpi.edu) +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appear in all copies and +// that both that copyright notice and this permission notice appear +// in supporting documentation. William E. Kempf makes no representations +// about the suitability of this software for any purpose. +// It is provided "as is" without express or implied warranty. +#ifndef BOOST_THREAD_MODEL_SINGLE_HPP +#define BOOST_THREAD_MODEL_SINGLE_HPP + +namespace boost { + +struct single_threaded { + struct mixin {}; + + struct lock + { + lock(const mixin&) {} + }; +}; + +} // end namespace boost + +#endif // BOOST_THREAD_MODEL_SINGLE_HPP