cli.hpp (1211B)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | /* Relacy Race Detector * Copyright (c) 2008-2010, Dmitry S. Vyukov * All rights reserved. * This software is provided AS-IS with no warranty, either express or implied. * This software is distributed under a license and may not be copied, * modified or distributed except as expressly authorized under the * terms of the license contained in the file LICENSE.TXT in this distribution. */ #ifndef RL_CLI_HPP #define RL_CLI_HPP #ifdef _MSC_VER # pragma once #endif #include "base.hpp" #include "context_base.hpp" #include "atomic_fence.hpp" namespace rl { struct Thread { static void MemoryBarrier(debug_info_param info) { atomic_thread_fence(mo_seq_cst, info); } template<typename T> static T VolatileRead(generic_atomic<T, true> const& v, debug_info_param info) { return v.load(mo_acquire, info); } template<typename T> static void VolatileWrite(generic_atomic<T, true>& v, T x, debug_info_param info) { v.store(x, mo_release, info); } static void SpinWait(int iterations, debug_info_param info) { ctx().yield(iterations, info); } }; } #endif |