NewMadeleine

Documentation

« back to PM2 home.
Front-end for generic locking

locking with pioman: always use all locks (even if the application is not threaded, pioman itself is threaded). More...

Data Structures

struct  nm_spinlock_s
 

Typedefs

typedef struct nm_spinlock_s nm_spinlock_t
 

Functions

static void nm_spin_init (nm_spinlock_t *p_spin)
 init the spin lock
 
static void nm_spin_destroy (nm_spinlock_t *p_spin)
 destroy the spin lock
 
static void nm_spin_lock (nm_spinlock_t *p_spin)
 acquire the spin lock
 
static void nm_spin_unlock (nm_spinlock_t *p_spin)
 release the spin lock
 
static int nm_spin_trylock (nm_spinlock_t *p_spin)
 try to lock the spin lock return 1 if lock is successfully acquired, 0 otherwise
 
static void nm_spin_assert_locked (nm_spinlock_t *p_spin)
 assert that current thread holds the lock
 
static void nm_spin_assert_notlocked (nm_spinlock_t *p_spin)
 assert that current thread doesn't hold the lock
 
static void nm_spin_check_nothread (nm_spinlock_t *p_spin __attribute__((unused)))
 check that we are always called from the same thread in case of non-threaded mode
 
static void nm_spin_clear_nothread (nm_spinlock_t *p_spin __attribute__((unused)))
 clear the last_tid tracking for lock consistency checking
 
static void nm_spin_init (nm_spinlock_t *p_spin __attribute__((unused)))
 
static void nm_spin_destroy (nm_spinlock_t *p_spin __attribute__((unused)))
 
static void nm_spin_lock (nm_spinlock_t *p_spin __attribute__((unused)))
 
static void nm_spin_unlock (nm_spinlock_t *p_spin __attribute__((unused)))
 
static int nm_spin_trylock (nm_spinlock_t *p_spin __attribute__((unused)))
 
static void nm_spin_assert_locked (nm_spinlock_t *p_spin __attribute__((unused)))
 
static void nm_spin_assert_notlocked (nm_spinlock_t *p_spin __attribute__((unused)))
 

Detailed Description

locking with pioman: always use all locks (even if the application is not threaded, pioman itself is threaded).

locking without pioman:

  • single : no locking
  • funneled : lock in rcache
  • serialized : + mem fence in spinlocks (no locks) + lock in allocators + atomics in refcounts
  • multiple : not supported without pioman

Typedef Documentation

◆ nm_spinlock_t

typedef struct nm_spinlock_s nm_spinlock_t

Definition at line 1018 of file nm_core_interface.h.

Function Documentation

◆ nm_spin_assert_locked() [1/2]

static void nm_spin_assert_locked ( nm_spinlock_t *p_spin   __attribute__(unused))
inlinestatic

Definition at line 1181 of file nm_core_interface.h.

References assert().

Here is the call graph for this function:

◆ nm_spin_assert_locked() [2/2]

static void nm_spin_assert_locked ( nm_spinlock_t p_spin)
inlinestatic

assert that current thread holds the lock

Referenced by nm_core_lock_assert().

◆ nm_spin_assert_notlocked() [1/2]

static void nm_spin_assert_notlocked ( nm_spinlock_t *p_spin   __attribute__(unused))
inlinestatic

Definition at line 1193 of file nm_core_interface.h.

References assert().

Here is the call graph for this function:

◆ nm_spin_assert_notlocked() [2/2]

static void nm_spin_assert_notlocked ( nm_spinlock_t p_spin)
inlinestatic

assert that current thread doesn't hold the lock

Referenced by nm_core_nolock_assert().

◆ nm_spin_check_nothread()

static void nm_spin_check_nothread ( nm_spinlock_t *p_spin   __attribute__(unused))
inlinestatic

check that we are always called from the same thread in case of non-threaded mode

Definition at line 1046 of file nm_core_interface.h.

References assert(), nm_core_get_thread_level(), NM_FATAL, and NM_THREAD_SERIALIZED.

Referenced by nm_spin_lock(), and nm_spin_trylock().

Here is the call graph for this function:

◆ nm_spin_clear_nothread()

static void nm_spin_clear_nothread ( nm_spinlock_t *p_spin   __attribute__(unused))
inlinestatic

clear the last_tid tracking for lock consistency checking

Definition at line 1067 of file nm_core_interface.h.

References assert(), nm_core_get_thread_level(), NM_FATAL, NM_THREAD_SERIALIZED, and NM_WARN.

Referenced by nm_spin_unlock().

Here is the call graph for this function:

◆ nm_spin_destroy() [1/2]

static void nm_spin_destroy ( nm_spinlock_t *p_spin   __attribute__(unused))
inlinestatic

Definition at line 1099 of file nm_core_interface.h.

References assert().

Here is the call graph for this function:

◆ nm_spin_destroy() [2/2]

static void nm_spin_destroy ( nm_spinlock_t p_spin)
inlinestatic

destroy the spin lock

Referenced by nm_core_lock_destroy(), and nm_refcount_destroy().

◆ nm_spin_init() [1/2]

static void nm_spin_init ( nm_spinlock_t *p_spin   __attribute__(unused))
inlinestatic

Definition at line 1087 of file nm_core_interface.h.

◆ nm_spin_init() [2/2]

static void nm_spin_init ( nm_spinlock_t p_spin)
inlinestatic

init the spin lock

Referenced by nm_core_lock_init(), and nm_refcount_init().

◆ nm_spin_lock() [1/2]

static void nm_spin_lock ( nm_spinlock_t *p_spin   __attribute__(unused))
inlinestatic

Definition at line 1110 of file nm_core_interface.h.

References nm_core_get_thread_level(), NM_FATAL, nm_spin_check_nothread(), and NM_THREAD_SERIALIZED.

Here is the call graph for this function:

◆ nm_spin_lock() [2/2]

static void nm_spin_lock ( nm_spinlock_t p_spin)
inlinestatic

acquire the spin lock

Referenced by nm_core_lock(), nm_refcount_dec(), and nm_refcount_inc_internal().

◆ nm_spin_trylock() [1/2]

static int nm_spin_trylock ( nm_spinlock_t *p_spin   __attribute__(unused))
inlinestatic

Definition at line 1152 of file nm_core_interface.h.

References assert(), nm_core_get_thread_level(), nm_spin_check_nothread(), and NM_THREAD_SERIALIZED.

Here is the call graph for this function:

◆ nm_spin_trylock() [2/2]

static int nm_spin_trylock ( nm_spinlock_t p_spin)
inlinestatic

try to lock the spin lock return 1 if lock is successfully acquired, 0 otherwise

Referenced by nm_core_trylock().

◆ nm_spin_unlock() [1/2]

static void nm_spin_unlock ( nm_spinlock_t *p_spin   __attribute__(unused))
inlinestatic

Definition at line 1133 of file nm_core_interface.h.

References assert(), nm_core_get_thread_level(), nm_spin_clear_nothread(), and NM_THREAD_SERIALIZED.

Here is the call graph for this function:

◆ nm_spin_unlock() [2/2]

static void nm_spin_unlock ( nm_spinlock_t p_spin)
inlinestatic

release the spin lock

Referenced by nm_core_unlock(), nm_refcount_dec(), and nm_refcount_inc_internal().