|
Toast Engine
|
Pool of independent Lua interpreters. More...
#include <atomic>#include <cstdint>#include <functional>#include <memory>#include <mutex>#include <optional>#include <string>#include <string_view>#include <toast/export.hpp>#include <toast/log.hpp>#include <toast/thread_pool.hpp>#include <unordered_map>#include <vector>
Go to the source code of this file.
Classes | |
| class | scripting::LuaState |
| class | scripting::LuaState::Lock |
| Ownership of one interpreter for as long as the object lives. More... | |
| class | scripting::LuaState::NonBlockingScope |
| While one exists on a thread, lock() on that thread never waits. More... | |
Macros | |
| #define | TOAST_LUA_ASSERT_OWNED(state) |
Pool of independent Lua interpreters.
A Lua interpreter is not thread safe, so every interpreter has exactly one owner thread at a time and only the owner may touch its stack, its registry or any reference that lives inside it
The rules that keep this deadlock free:
| #define TOAST_LUA_ASSERT_OWNED | ( | state | ) |
Check that the calling thread owns the interpreter state belongs to. Debug builds assert it, and the builds that define TOAST_LUA_OWNERSHIP_CHECKS (RelWithDebInfo) abort with a message, since a violation is a corrupted heap waiting to happen and the abort points at where it started