Executes a task with exclusive access.
Waits for any previously queued tasks to complete before executing. The mutex is properly released even if the task throws an error.
The type of value returned by the task
A promise that resolves to the task's return value
Mutual exclusion primitive for coordinating asynchronous operations.
Ensures that only one task executes at a time, even when multiple tasks are queued concurrently. Tasks are executed in FIFO order.