Serene Runtime 1.0.0-dev
C runtime for the Serene programming language
Loading...
Searching...
No Matches
srn_fiber_mutex_t Struct Reference

#include <mutex.h>

Collaboration diagram for srn_fiber_mutex_t:
[legend]

Public Member Functions

 _Atomic (srn_fiber_t *) state
 A pointer to the waiter's stack head.

Data Fields

srn_fiber_twaiters_head
 A private (In the sense that it only touched only by the current lock holder during unlock) pointer to the head of the waiters in order.

Detailed Description

Definition at line 44 of file mutex.h.

Member Function Documentation

◆ _Atomic()

srn_fiber_mutex_t::_Atomic ( srn_fiber_t * )

A pointer to the waiter's stack head.

nullptr == unlocked. Contending fibers push onto the stack lock free, and the holder drains it (it's basically a treiber stack). So having a waiter implies the lock is acquired by someone.

Field Documentation

◆ waiters_head

srn_fiber_t* srn_fiber_mutex_t::waiters_head

A private (In the sense that it only touched only by the current lock holder during unlock) pointer to the head of the waiters in order.

Since it is private it needs not to be atomic. The holder fills it in one reversed batch when it drains the incoming stack, then pops one fiber from its head per unlock. Threaded through srn_fiber_t.link.

Definition at line 54 of file mutex.h.


The documentation for this struct was generated from the following file: