template <SpinLockOptions Options>

class SpinLockBase

Defined at line 36 of file ../../zircon/kernel/include/kernel/spinlock.h

Public Methods

void SpinLockBase<Options> ()

Defined at line 40 of file ../../zircon/kernel/include/kernel/spinlock.h

void SpinLockBase<Options> (const fxt::InternedString & lock_name_string_ref)

Defined at line 41 of file ../../zircon/kernel/include/kernel/spinlock.h

void Acquire ()

Acquire the spinlock.

Interrupts must already be disabled.

Defined at line 47 of file ../../zircon/kernel/include/kernel/spinlock.h

void Acquire (const char * name)

See |Acquire| above.

|name| is the name of the critical section protected by this spinlock and

must have static lifetime.

Defined at line 62 of file ../../zircon/kernel/include/kernel/spinlock.h

bool TryAcquire ()

Attempt to acquire the spinlock without waiting.

Interrupts must already be disabled.

Returns false when the lock is acquired, and true when the lock is not

acquired.

TryAcquire operations are not permitted to fail spuriously, even on

architectures with weak memory ordering. If a TryAcquire operation fails,

it must be because the lock was actually observed to be held by another

thread during the attempt.

Defined at line 85 of file ../../zircon/kernel/include/kernel/spinlock.h

bool TryAcquire (const char * name)

See |TryAcquire| above.

Defined at line 90 of file ../../zircon/kernel/include/kernel/spinlock.h

void Release ()

Release the spinlock

Interrupts must already be disabled.

Defined at line 102 of file ../../zircon/kernel/include/kernel/spinlock.h

bool IsHeld ()

Returns true if held by the calling CPU.

Interrupts must be disabled before calling this method, otherwise it could return true when it

should return false.

Defined at line 113 of file ../../zircon/kernel/include/kernel/spinlock.h

void AcquireIrqSave (interrupt_saved_state_t & state)

Just like |Acquire|, but saves interrupt state and disables interrupts.

Defined at line 119 of file ../../zircon/kernel/include/kernel/spinlock.h

void AcquireIrqSave (interrupt_saved_state_t & state, const char * name)

Defined at line 123 of file ../../zircon/kernel/include/kernel/spinlock.h

void ReleaseIrqRestore (interrupt_saved_state_t state)

Just like |Release|, but restores interrupt state before unlocking.

Defined at line 129 of file ../../zircon/kernel/include/kernel/spinlock.h

void AssertHeld ()

Defined at line 134 of file ../../zircon/kernel/include/kernel/spinlock.h

cpu_num_t HolderCpu ()

Returns which cpu currently holds the spin lock, or INVALID_CPU if not held.

Defined at line 137 of file ../../zircon/kernel/include/kernel/spinlock.h

void SpinLockBase<Options> (const SpinLockBase<Options> & am)

SpinLocks cannot be copied or moved.

Defined at line 140 of file ../../zircon/kernel/include/kernel/spinlock.h

SpinLockBase<Options> & operator= (const SpinLockBase<Options> & am)

Defined at line 141 of file ../../zircon/kernel/include/kernel/spinlock.h

void SpinLockBase<Options> (SpinLockBase<Options> && c)

Defined at line 142 of file ../../zircon/kernel/include/kernel/spinlock.h

SpinLockBase<Options> & operator= (SpinLockBase<Options> && c)

Defined at line 143 of file ../../zircon/kernel/include/kernel/spinlock.h