medfall

A super great game engine
Log | Files | Refs

relacy.hpp (2107B)


      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_RELACY_HPP
     11 #define RL_RELACY_HPP
     12 #ifdef _MSC_VER
     13 #   pragma once
     14 #endif
     15 
     16 
     17 #include "base.hpp"
     18 #include "context.hpp"
     19 #include "context_base_impl.hpp"
     20 #include "backoff.hpp"
     21 #include "atomic_fence.hpp"
     22 #include "atomic.hpp"
     23 #include "var.hpp"
     24 #include "thread_local.hpp"
     25 #include "test_suite.hpp"
     26 #include "dyn_thread.hpp"
     27 
     28 #include "stdlib/mutex.hpp"
     29 #include "stdlib/condition_variable.hpp"
     30 #include "stdlib/semaphore.hpp"
     31 #include "stdlib/event.hpp"
     32 
     33 #include "stdlib/windows.hpp"
     34 #include "stdlib/pthread.hpp"
     35 
     36 #define VAR_T(x) rl::var<x>
     37 #define TLS_T(T) rl::thread_local_var<T>
     38 #define VAR(x) x($)
     39 
     40 #ifndef RL_FORCE_SEQ_CST
     41 #define memory_order_relaxed mo_relaxed, $
     42 #define memory_order_consume mo_consume, $
     43 #define memory_order_acquire mo_acquire, $
     44 #define memory_order_release mo_release, $
     45 #define memory_order_acq_rel mo_acq_rel, $
     46 #define memory_order_seq_cst mo_seq_cst, $
     47 #else
     48 #define memory_order_relaxed mo_seq_cst, $
     49 #define memory_order_consume mo_seq_cst, $
     50 #define memory_order_acquire mo_seq_cst, $
     51 #define memory_order_release mo_seq_cst, $
     52 #define memory_order_acq_rel mo_seq_cst, $
     53 #define memory_order_seq_cst mo_seq_cst, $
     54 #endif
     55 
     56 #define new                 RL_NEW_PROXY
     57 #define delete              RL_DELETE_PROXY
     58 #define malloc(sz)          rl::rl_malloc((sz), $)
     59 #define calloc(sz, cnt)     rl::rl_calloc((sz), (cnt), $)
     60 // #define realloc(p, sz)      rl::rl_realloc((p), (sz), $)
     61 #define free(p)             rl::rl_free((p), $)
     62 
     63 #ifdef assert
     64 #undef assert
     65 #endif
     66 #define assert              RL_ASSERT
     67 
     68 #ifdef errno
     69 #undef errno
     70 #endif
     71 #define errno               (rl::get_errno())
     72 
     73 #endif