BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
non_preemptable_scope_check.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <fc/time.hpp>
4 
5 // This file defines a macro:
6 // ASSERT_TASK_NOT_PREEMPTED()
7 // This macro is used to declare that the current scope is not expected to yield.
8 // If the task does yield, it will generate an assertion.
9 //
10 // Use this when you you're coding somethign that must not yield, and you think you
11 // have done it (just by virtue of the fact that you don't think you've called any
12 // functions that could yield). This will help detect when your assumptions are
13 // wrong and you accidentally call something that yields.
14 //
15 // This has no cost in release mode, and is extremely cheap in debug mode.
16 
17 #define FC_NON_PREEMPTABLE_SCOPE_COMBINE_HELPER(x,y) x ## y
18 #define FC_NON_PREEMPTABLE_SCOPE_COMBINE(x,y) FC_NON_PREEMPTABLE_SCOPE_COMBINE_HELPER(x,y)
19 
20 #ifdef NDEBUG
21 # define ASSERT_TASK_NOT_PREEMPTED() do {} while (0)
22 #else
23 # define ASSERT_TASK_NOT_PREEMPTED() fc::non_preemptable_scope_check FC_NON_PREEMPTABLE_SCOPE_COMBINE(scope_checker_, __LINE__)
24 
25 namespace fc
26 {
28  {
29  public:
32  };
33 } // namespace fc
34 #endif
35 
fc
Definition: api.hpp:15
spin_yield_lock.hpp
fc::non_preemptable_scope_check::non_preemptable_scope_check
non_preemptable_scope_check()
Definition: non_preemptable_scope_check.cpp:9
fc::non_preemptable_scope_check::~non_preemptable_scope_check
~non_preemptable_scope_check()
Definition: non_preemptable_scope_check.cpp:14
time.hpp
fc::non_preemptable_scope_check
Definition: non_preemptable_scope_check.hpp:27