1/* ThreadSanitizer 2 * Copyright (c) 2011, Google Inc. All rights reserved. 3 * Author: Dmitry Vyukov (dvyukov) 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Neither the name of Google Inc. nor the names of its 11 * contributors may be used to endorse or promote products derived from 12 * this software without specific prior written permission. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#ifndef TS_ATOMIC_INT_H_INCLUDED 28#define TS_ATOMIC_INT_H_INCLUDED 29 30#include "ts_atomic.h" 31#include "ts_util.h" 32#include <stddef.h> 33 34// Helper functions for atomic support 35 36char const* tsan_atomic_to_str(tsan_memory_order mo); 37char const* tsan_atomic_to_str(tsan_atomic_op op); 38bool tsan_atomic_is_acquire(tsan_memory_order mo); 39bool tsan_atomic_is_release(tsan_memory_order mo); 40bool tsan_atomic_is_rmw(tsan_atomic_op op); 41void tsan_atomic_verify(tsan_atomic_op op, 42 tsan_memory_order mo, 43 tsan_memory_order fail_mo, 44 size_t size, 45 void volatile* a); 46uint64_t tsan_atomic_do_op(tsan_atomic_op op, 47 tsan_memory_order mo, 48 tsan_memory_order fail_mo, 49 size_t size, 50 void volatile* a, 51 uint64_t v, 52 uint64_t cmp, 53 uint64_t* newv, 54 uint64_t* prev); 55 56#endif // #ifndef TS_ATOMIC_INT_H_INCLUDED 57 58