X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=boost%2Fboost%2Fdetail%2Flightweight_mutex.hpp;h=b7a7f6dd4ed6139f1c18bf8d33e5a7e7020669e0;hb=43c09d723435a5b203f2ac0c39e2086de836b386;hp=1310da375596714da19547580cc3f591ac8e70a4;hpb=e1644a68eb123c267a7ef2e651c66b788c38f03a;p=lyx.git diff --git a/boost/boost/detail/lightweight_mutex.hpp b/boost/boost/detail/lightweight_mutex.hpp index 1310da3755..b7a7f6dd4e 100644 --- a/boost/boost/detail/lightweight_mutex.hpp +++ b/boost/boost/detail/lightweight_mutex.hpp @@ -1,89 +1,22 @@ #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED #define BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // // boost/detail/lightweight_mutex.hpp - lightweight mutex // -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -// typedef boost::detail::lightweight_mutex; -// -// boost::detail::lightweight_mutex meets a subset of the Mutex concept -// requirements: http://www.boost.org/libs/thread/doc/mutex_concept.html#Mutex -// -// * Used by the smart pointer library -// * Performance oriented -// * Header-only implementation -// * Small memory footprint -// * Not a general purpose mutex, use boost::mutex, CRITICAL_SECTION or -// pthread_mutex instead. -// * Never spin in a tight lock/do-something/unlock loop, since -// lightweight_mutex does not guarantee fairness. -// * Never keep a lightweight_mutex locked for long periods. -// -// The current implementation can use a pthread_mutex, a CRITICAL_SECTION, -// or a platform-specific spinlock. -// -// You can force a particular implementation by defining BOOST_LWM_USE_PTHREADS, -// BOOST_LWM_USE_CRITICAL_SECTION, or BOOST_LWM_USE_SPINLOCK. -// -// If neither macro has been defined, the default is to use a spinlock on Win32, -// and a pthread_mutex otherwise. +// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. // -// Note that a spinlock is not a general synchronization primitive. In particular, -// it is not guaranteed to be a memory barrier, and it is possible to "livelock" -// if a lower-priority thread has acquired the spinlock but a higher-priority -// thread is spinning trying to acquire the same lock. +// 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 // -// For these reasons, spinlocks have been disabled by default except on Windows, -// where a spinlock can be several orders of magnitude faster than a CRITICAL_SECTION. - -// Note: lwm_linux.hpp has been disabled by default; see the comments -// inside for more info. - - -#include - -// Note to implementors: if you write a platform-specific spinlock -// for a platform that supports pthreads, be sure to test its performance -// against the pthreads-based version using shared_ptr_timing_test.cpp and -// shared_ptr_mt_test.cpp. Custom versions are usually not worth the trouble -// _unless_ the performance gains are substantial. -// -// Be sure to compare against a "real" pthreads library; -// shared_ptr_timing_test.cpp will compile succesfully with a stub do-nothing -// pthreads library, since it doesn't create any threads. - -#ifndef BOOST_HAS_THREADS -# include -#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(BOOST_USE_ASM_ATOMIC_H) -# include -#elif defined(BOOST_LWM_USE_CRITICAL_SECTION) -# include -#elif defined(BOOST_LWM_USE_PTHREADS) -# include -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) -# include -#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(__sgi) -# include -#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(__GLIBCPP__) -# include -#elif defined(BOOST_HAS_PTHREADS) -# define BOOST_LWM_USE_PTHREADS -# include -#else -// Use #define BOOST_DISABLE_THREADS to avoid the error -# error Unrecognized threading platform -#endif +#include #endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED