Overhaul of thread handling to support blocking functions other than wait
This commit is contained in:
@@ -212,6 +212,10 @@ public:
|
||||
//
|
||||
static World *fetch_global_pointer(lua_State *L);
|
||||
|
||||
// Check if the world is authoritative.
|
||||
//
|
||||
bool is_authoritative() const { return (world_type_ == util::WORLD_TYPE_MASTER) || (world_type_ == util::WORLD_TYPE_STANDALONE); }
|
||||
|
||||
// Serialize and deserialize.
|
||||
//
|
||||
void serialize(StreamBuffer *sb);
|
||||
@@ -245,7 +249,7 @@ public:
|
||||
// cleared.
|
||||
//
|
||||
void clear_lthread_state();
|
||||
void open_lthread_state(int64_t actor_id, int64_t place_id, bool ppool, bool prints);
|
||||
void open_lthread_state(int64_t actor_id, int64_t place_id, int64_t thread_id, bool ppool, bool prints);
|
||||
void close_lthread_state();
|
||||
|
||||
std::ostream *lthread_print_stream() const;
|
||||
@@ -260,7 +264,6 @@ public:
|
||||
int64_t alloc_id_predictable();
|
||||
|
||||
private:
|
||||
|
||||
// Store a pointer to a world model into a lua registry.
|
||||
//
|
||||
static void store_global_pointer(lua_State *L, World *w);
|
||||
@@ -489,6 +492,7 @@ private:
|
||||
//
|
||||
int64_t lthread_actor_id_;
|
||||
int64_t lthread_place_id_;
|
||||
int64_t lthread_thread_id_;
|
||||
int64_t lthread_use_ppool_;
|
||||
std::unique_ptr<eng::ostringstream> lthread_prints_;
|
||||
|
||||
@@ -503,6 +507,8 @@ private:
|
||||
friend int lfn_tangible_scan(lua_State *L);
|
||||
friend int lfn_math_random(lua_State *L);
|
||||
friend int lfn_math_randomstate(lua_State *L);
|
||||
friend int lfn_wait(lua_State *L);
|
||||
friend int lfn_nopredict(lua_State *L);
|
||||
};
|
||||
|
||||
using UniqueWorld = std::unique_ptr<World>;
|
||||
|
||||
Reference in New Issue
Block a user