struct Slab
Defined at line 205 of file ../../third_party/perfetto/include/perfetto/ext/base/lock_free_task_runner.h
A slab is a fixed-size array of tasks. The lifecycle of a task slot
within a slab goes through three phases:
1. Reservation: A writer thread atomically increments `next_task_slot` to
reserve a slot in the `tasks` array. This reservation establishes the
implicit order in which the consumer will attempt to read tasks (but
only if they are published in the bitmap, see below).
2. Publishing: After writing the task into its reserved slot, the writer
thread atomically sets the corresponding bit in the `tasks_written`
bitmask. This acts as a memory barrier and makes the task visible to
the consumer (main) thread.
3. Consumption: The main thread acquire-reads the `tasks_written` bitmask.
For each bit that is set, it processes the task and then sets the
corresponding bit in its private `tasks_read` bitmask to prevent
reading the same task again.
Public Members
atomic next_task_slot
array tasks
array tasks_written
array tasks_read
Slab * prev
Public Methods
void Slab ()
void ~Slab ()