19#ifdef SCRIPTAPI_LOCK_DEBUG
24 LockChecker(
int *recursion_counter, std::thread::id *owning_thread)
26 m_lock_recursion_counter = recursion_counter;
27 m_owning_thread = owning_thread;
28 m_original_level = *recursion_counter;
30 if (*m_lock_recursion_counter > 0) {
31 assert(*m_owning_thread == std::this_thread::get_id());
33 *m_owning_thread = std::this_thread::get_id();
36 (*m_lock_recursion_counter)++;
41 assert(*m_owning_thread == std::this_thread::get_id());
42 assert(*m_lock_recursion_counter > 0);
44 (*m_lock_recursion_counter)--;
46 assert(*m_lock_recursion_counter == m_original_level);
50 int *m_lock_recursion_counter;
52 std::thread::id *m_owning_thread;
55#define SCRIPTAPI_LOCK_CHECK \
56 LockChecker scriptlock_checker( \
57 &this->m_lock_recursion_count, \
58 &this->m_owning_thread)
61 #define SCRIPTAPI_LOCK_CHECK while(0)
64#define SCRIPTAPI_PRECHECKHEADER \
65 RecursiveMutexAutoLock scriptlock(this->m_luastackmutex); \
66 SCRIPTAPI_LOCK_CHECK; \
68 lua_State *L = getStack(); \
69 assert(lua_checkstack(L, 20)); \
70 StackUnroller stack_unroller(L);