memory_order.hpp (1143B)
1 /* Relacy Race Detector 2 * Copyright (c) 2008-2013, Dmitry S. Vyukov 3 * All rights reserved. 4 * This software is provided AS-IS with no warranty, either express or implied. 5 * This software is distributed under a license and may not be copied, 6 * modified or distributed except as expressly authorized under the 7 * terms of the license contained in the file LICENSE in this distribution. 8 */ 9 10 #ifndef RL_MEMORY_ORDER_HPP 11 #define RL_MEMORY_ORDER_HPP 12 #ifdef _MSC_VER 13 # pragma once 14 #endif 15 16 #include "base.hpp" 17 18 19 namespace rl 20 { 21 22 23 enum memory_order 24 { 25 mo_relaxed, 26 mo_consume, 27 mo_acquire, 28 mo_release, 29 mo_acq_rel, 30 mo_seq_cst, 31 }; 32 33 34 35 36 inline char const* format(memory_order mo) 37 { 38 switch (mo) 39 { 40 case mo_relaxed: return "relaxed"; 41 case mo_consume: return "consume"; 42 case mo_acquire: return "acquire"; 43 case mo_release: return "release"; 44 case mo_acq_rel: return "acq_rel"; 45 case mo_seq_cst: return "seq_cst"; 46 } 47 RL_VERIFY(!"invalid value of memory order"); 48 throw std::logic_error("invalid value of memory order"); 49 } 50 51 52 } 53 54 #endif