Rizin
unix-like reverse engineering framework and cli tools
spinlock.h File Reference
#include "internal.h"
#include "atomic-ops.h"

Go to the source code of this file.

Classes

struct  uv_spinlock_t
 

Macros

#define UV_SPINLOCK_INITIALIZER   { 0 }
 

Functions

 UV_UNUSED (static void uv_spinlock_init(uv_spinlock_t *spinlock))
 
 UV_UNUSED (static int uv_spinlock_trylock(uv_spinlock_t *spinlock))
 

Macro Definition Documentation

◆ UV_SPINLOCK_INITIALIZER

#define UV_SPINLOCK_INITIALIZER   { 0 }

Definition at line 22 of file spinlock.h.

Function Documentation

◆ UV_UNUSED() [1/2]

UV_UNUSED ( static int   uv_spinlock_trylockuv_spinlock_t *spinlock)

Definition at line 45 of file spinlock.h.

45  {
46  /* TODO(bnoordhuis) Maybe change to a ticket lock to guarantee fair queueing.
47  * Not really critical until we have locks that are (frequently) contended
48  * for by several threads.
49  */
50  return 0 == cmpxchgi(&spinlock->lock, 0, 1);
51 }

References uv_spinlock_t::lock.

◆ UV_UNUSED() [2/2]

UV_UNUSED ( static void   uv_spinlock_inituv_spinlock_t *spinlock)

Definition at line 33 of file spinlock.h.

33  {
34  ACCESS_ONCE(int, spinlock->lock) = 0;
35 }
#define ACCESS_ONCE(type, var)
Definition: internal.h:79

References ACCESS_ONCE, and uv_spinlock_t::lock.