Skip to content

Commit 54c0c3c

Browse files
committed
Fix concurrent executions on compat mode
1 parent f18764c commit 54c0c3c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/LuaEngine/LuaEngine.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ struct LuaScript
106106

107107
#define ALE_STATE_PTR "ALE State Ptr"
108108
#define LOCK_ALE ALE::Guard __guard(ALE::GetLock())
109-
#define LOCK_ALE_STATE ALE::Guard __guard(this->GetStateLock())
109+
#define LOCK_ALE_STATE \
110+
ALE::Guard __ale_guard(ALEConfig::GetInstance().IsMultistateEnabled() ? ALE::GetNoopLock() : ALE::GetLock()); \
111+
Guard __ale_state_guard(this->GetStateLock())
110112
#define ALE_GLOBAL_STATE (uint32)(-1)
111113

112114
#define ALE_GAME_API AC_GAME_API
@@ -123,6 +125,7 @@ class ALE_GAME_API ALE
123125
const std::string& GetRequireCPath() const { return lua_requirecpath; }
124126

125127
LockType& GetStateLock() { return stateLock; }
128+
static LockType& GetNoopLock() { static LockType noop; return noop; }
126129
uint32 GetStateMapId() const { return stateMapId; }
127130
uint32 GetStateInstanceId() const { return stateInstanceId; }
128131
ALE** GetSelfPtr() { return selfPtr ? selfPtr : &ALE::GALE; }

0 commit comments

Comments
 (0)