medfall

A super great game engine
Log | Files | Refs

context_base_impl.hpp (1490B)


      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_CONTEXT_BASE_IMPL_HPP
     11 #define RL_CONTEXT_BASE_IMPL_HPP
     12 #ifdef _MSC_VER
     13 #   pragma once
     14 #endif
     15 
     16 
     17 namespace rl
     18 {
     19 
     20 /*
     21 inline void context::disable_history()
     22 {
     23     RL_VERIFY(threadx_);
     24     threadx_->disable_history_ += 1;
     25 }
     26 
     27 inline void context::enable_history()
     28 {
     29     RL_VERIFY(threadx_);
     30     RL_VERIFY(threadx_->disable_history_);
     31     threadx_->disable_history_ -= 1;
     32 }
     33 */
     34 
     35 inline void context::disable_preemption()
     36 {
     37     disable_preemption_ += 1;
     38 }
     39 
     40 inline void context::enable_preemption()
     41 {
     42     disable_preemption_ -= 1;
     43 }
     44 
     45 inline int context::get_errno()
     46 {
     47     RL_VERIFY(threadx_);
     48     return threadx_->errno_;
     49 }
     50 
     51 inline void context::set_errno(int value)
     52 {
     53     RL_VERIFY(threadx_);
     54     threadx_->errno_ = value;
     55 }
     56 
     57 template<typename event_t>
     58 void context::exec_log(debug_info_param info, event_t const& ev)
     59 {
     60     RL_VERIFY(collecting_history());
     61     disable_alloc_ += 1;
     62     history_.exec_log(threadx_ ? threadx_->index_ : -1, info, ev, params_.output_history);
     63     disable_alloc_ -= 1;
     64 }
     65 
     66 
     67 
     68 }
     69 
     70 
     71 
     72 #endif