spinlock_nt.hpp added, Cygwin fixes.

[SVN r44055]
This commit is contained in:
Peter Dimov
2008-04-05 15:06:31 +00:00
parent 515be965bd
commit acb6824ef7
6 changed files with 120 additions and 18 deletions
+3 -1
View File
@@ -32,10 +32,12 @@
#if defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
# include <boost/detail/spinlock_sync.hpp>
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# include <boost/detail/spinlock_w32.hpp>
#elif defined(BOOST_HAS_PTHREADS)
# include <boost/detail/spinlock_pt.hpp>
#elif !defined(BOOST_HAS_THREADS)
# include <boost/detail/spinlock_nt.hpp>
#else
# error Unrecognized threading platform
#endif
+67
View File
@@ -0,0 +1,67 @@
#ifndef BOOST_DETAIL_SPINLOCK_NT_HPP_INCLUDED
#define BOOST_DETAIL_SPINLOCK_NT_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// Copyright (c) 2008 Peter Dimov
//
// 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)
//
namespace boost
{
namespace detail
{
class spinlock
{
public:
inline bool try_lock()
{
return true;
}
inline void lock()
{
}
inline void unlock()
{
}
public:
class scoped_lock
{
private:
scoped_lock( scoped_lock const & );
scoped_lock & operator=( scoped_lock const & );
public:
explicit scoped_lock( spinlock & /*sp*/ )
{
}
~scoped_lock()
{
}
};
};
} // namespace detail
} // namespace boost
#define BOOST_DETAIL_SPINLOCK_INIT {}
#endif // #ifndef BOOST_DETAIL_SPINLOCK_NT_HPP_INCLUDED
+2 -1
View File
@@ -25,7 +25,7 @@
#include <boost/config.hpp>
#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
#if defined( BOOST_USE_WINDOWS_H )
# include <windows.h>
@@ -33,6 +33,7 @@
#if defined(_MSC_VER) && _MSC_VER >= 1310
extern "C" void _mm_pause();
# pragma intrinsic( _mm_pause )
#endif
namespace boost