Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 1 | #ifndef NDNBOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED |
| 2 | #define NDNBOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 3 | |
| 4 | // MS compatible compilers support #pragma once |
| 5 | |
| 6 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
| 7 | # pragma once |
| 8 | #endif |
| 9 | |
| 10 | // |
Jeff Thompson | 9939dcd | 2013-10-15 15:12:24 -0700 | [diff] [blame] | 11 | // ndnboost/detail/spinlock.hpp |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 12 | // |
| 13 | // Copyright (c) 2008 Peter Dimov |
| 14 | // |
| 15 | // Distributed under the Boost Software License, Version 1.0. |
| 16 | // See accompanying file LICENSE_1_0.txt or copy at |
| 17 | // http://www.boost.org/LICENSE_1_0.txt) |
| 18 | // |
| 19 | // struct spinlock |
| 20 | // { |
| 21 | // void lock(); |
| 22 | // bool try_lock(); |
| 23 | // void unlock(); |
| 24 | // |
| 25 | // class scoped_lock; |
| 26 | // }; |
| 27 | // |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 28 | // #define NDNBOOST_DETAIL_SPINLOCK_INIT <unspecified> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 29 | // |
| 30 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 31 | #include <ndnboost/config.hpp> |
| 32 | #include <ndnboost/smart_ptr/detail/sp_has_sync.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 33 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 34 | #if defined( NDNBOOST_SP_USE_PTHREADS ) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 35 | # include <ndnboost/smart_ptr/detail/spinlock_pt.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 36 | |
| 37 | #elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 38 | # include <ndnboost/smart_ptr/detail/spinlock_gcc_arm.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 39 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 40 | #elif defined( NDNBOOST_SP_HAS_SYNC ) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 41 | # include <ndnboost/smart_ptr/detail/spinlock_sync.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 42 | |
| 43 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 44 | # include <ndnboost/smart_ptr/detail/spinlock_w32.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 45 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 46 | #elif defined(NDNBOOST_HAS_PTHREADS) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 47 | # include <ndnboost/smart_ptr/detail/spinlock_pt.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 48 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 49 | #elif !defined(NDNBOOST_HAS_THREADS) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 50 | # include <ndnboost/smart_ptr/detail/spinlock_nt.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 51 | |
| 52 | #else |
| 53 | # error Unrecognized threading platform |
| 54 | #endif |
| 55 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 56 | #endif // #ifndef NDNBOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED |