Redesigned ID allocator and tangible.actor

This commit is contained in:
2021-10-14 11:43:16 -04:00
parent 50d62d9bfd
commit 796a3c4139
6 changed files with 131 additions and 126 deletions

View File

@@ -101,14 +101,6 @@ public:
// zero, or the batch contains fewer than 128 IDs.
void salvage(int64_t batch);
// Return the thread's batch to the global pool. If no batch
// is present, that's okay. Set the thread's batch to zero (invalid).
void salvage_thread(lua_State *L);
// Allocate an ID for the specified thread. Uses the thread's
// batch if possible. If not, fetches one ID from the global pool.
int64_t alloc_id_for_thread(lua_State *L);
// Serialize to or deserialize from a streambuffer.
void serialize(StreamBuffer *sb) const;
void deserialize(StreamBuffer *sb);
@@ -144,17 +136,8 @@ public:
// Refill the fifo of batches from the global pool.
void refill();
// Get a batch from the fifo. Also refills the fifo.
int64_t get_batch();
// Return the thread's batch to the global pool. If no batch
// is present, that's okay. Set the thread's batch to zero (invalid).
void salvage_thread(lua_State *L);
// Fetch a batch from the fifo and install it in the thread.
// If the thread already had a batch, the thread's previous batch
// is returned to the global pool.
void prepare_thread(lua_State *L);
// Get a single ID from the fifo. Also refills the fifo.
int64_t get_one();
// Return the size of the queue.
int size() { return ranges_.size(); }