HPCToolkit
spinlock.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include "stdatomic.h"
Include dependency graph for spinlock.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  spinlock_s
 

Macros

#define SPINLOCK_UNLOCKED_VALUE   (-1L)
 
#define SPINLOCK_LOCKED_VALUE   (1L)
 
#define INITIALIZE_SPINLOCK(x)   { .thelock = ATOMIC_VAR_INIT(x) }
 
#define SPINLOCK_UNLOCKED   INITIALIZE_SPINLOCK(SPINLOCK_UNLOCKED_VALUE)
 
#define SPINLOCK_LOCKED   INITIALIZE_SPINLOCK(SPINLOCK_LOCKED_VALUE)
 

Typedefs

typedef struct spinlock_s spinlock_t
 

Functions

static void spinlock_init (spinlock_t *l)
 
static void spinlock_unlock (spinlock_t *l)
 
static bool spinlock_is_locked (spinlock_t *l)
 
static void spinlock_lock (spinlock_t *l)
 
static bool limit_spinlock_lock (spinlock_t *l, size_t limit, long locked_val)
 
static bool hwt_cas_spinlock_lock (spinlock_t *l, size_t limit, long locked_val)
 
static bool hwt_limit_spinlock_lock (spinlock_t *l, size_t limit, long locked_val)
 

Macro Definition Documentation

◆ INITIALIZE_SPINLOCK

#define INITIALIZE_SPINLOCK (   x)    { .thelock = ATOMIC_VAR_INIT(x) }

Definition at line 82 of file spinlock.h.

◆ SPINLOCK_LOCKED

#define SPINLOCK_LOCKED   INITIALIZE_SPINLOCK(SPINLOCK_LOCKED_VALUE)

Definition at line 85 of file spinlock.h.

◆ SPINLOCK_LOCKED_VALUE

#define SPINLOCK_LOCKED_VALUE   (1L)

Definition at line 81 of file spinlock.h.

◆ SPINLOCK_UNLOCKED

#define SPINLOCK_UNLOCKED   INITIALIZE_SPINLOCK(SPINLOCK_UNLOCKED_VALUE)

Definition at line 84 of file spinlock.h.

◆ SPINLOCK_UNLOCKED_VALUE

#define SPINLOCK_UNLOCKED_VALUE   (-1L)

Definition at line 80 of file spinlock.h.

Typedef Documentation

◆ spinlock_t

typedef struct spinlock_s spinlock_t

Function Documentation

◆ hwt_cas_spinlock_lock()

static bool hwt_cas_spinlock_lock ( spinlock_t l,
size_t  limit,
long  locked_val 
)
inlinestatic

Definition at line 161 of file spinlock.h.

Here is the caller graph for this function:

◆ hwt_limit_spinlock_lock()

static bool hwt_limit_spinlock_lock ( spinlock_t l,
size_t  limit,
long  locked_val 
)
inlinestatic

Definition at line 191 of file spinlock.h.

Here is the call graph for this function:

◆ limit_spinlock_lock()

static bool limit_spinlock_lock ( spinlock_t l,
size_t  limit,
long  locked_val 
)
inlinestatic

Definition at line 134 of file spinlock.h.

Here is the call graph for this function:

◆ spinlock_init()

static void spinlock_init ( spinlock_t l)
inlinestatic

Definition at line 89 of file spinlock.h.

◆ spinlock_is_locked()

static bool spinlock_is_locked ( spinlock_t l)
inlinestatic

Definition at line 104 of file spinlock.h.

◆ spinlock_lock()

static void spinlock_lock ( spinlock_t l)
inlinestatic

Definition at line 111 of file spinlock.h.

Here is the caller graph for this function:

◆ spinlock_unlock()

static void spinlock_unlock ( spinlock_t l)
inlinestatic

Definition at line 96 of file spinlock.h.

Here is the caller graph for this function: