ngpt  2.2.1
About: Next Generation POSIX Threading (NGPT) is a project which introduces an M:N threading model to the Linux system.
  Fossies Dox: ngpt-2.2.1.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

pth_sync.c File Reference
#include "pth_p.h"
#include "allocation.h"
#include "schedule.h"
#include <sys/stat.h>
#include <errno.h>
Include dependency graph for pth_sync.c:

Go to the source code of this file.

Macros

#define SYNC_DEBUG_SHARED_INIT   1
 
#define PTH_COND_BOUNDED   _BIT(4)
 

Functions

intern int pth_initialize_shared (void)
 
intern int pth_find_shared_mutex (pth_mutex_t *mutex)
 
intern pth_mutex_t * pth_alloc_shared_mutex (void)
 
intern pth_cond_t * pth_alloc_shared_cond (void)
 
int pth_mutex_init (pth_mutex_t *mutex, pth_mutexattr_t *pattr)
 
static void _pth_acquire (pth_qlock_t *spinlock, pid_t tid)
 
static void _pth_release (pth_qlock_t *spinlock, pid_t tid)
 
int pth_mutex_acquire (pth_mutex_t *mutex, int tryonly, pth_event_t ev_extra)
 
int pth_shared_mutex_acquire (pth_mutex_t *mutex, int tryonly, pth_event_t ev_extra, pth_descr_t descr)
 
int pth_mutex_release (pth_mutex_t *mutex)
 
intern void pth_mutex_releaseall (pth_t thread)
 
int pth_mutex_destroy (pth_mutex_t *mutex)
 
int pth_rwlock_init (pth_rwlock_t *rwlock, int pshared)
 
int pth_rwlock_destroy (pth_rwlock_t *rwlock)
 
int pth_rwlock_acquire (pth_rwlock_t *rwlock, int op, int tryonly, pth_event_t ev_extra)
 
int pth_rwlock_release (pth_rwlock_t *rwlock)
 
int _pth_cond_init (pth_cond_t *cond, int pshared)
 
int pth_cond_destroy (pth_cond_t *cond)
 
static void pth_cond_cleanup_handler (void *_cleanvec) __attribute__((unused))
 
int pth_cond_await (pth_cond_t *cond, pth_mutex_t *mutex, pth_event_t ev_extra)
 
static int pth_check_waiters (void *arg)
 
int pth_cond_notify (pth_cond_t *cond, int broadcast)
 
int pth_barrier_init (pth_barrier_t *barrier, int threshold)
 
int pth_barrier_reach (pth_barrier_t *barrier)
 

Variables

intern int pth_shared_fd = 0
 
intern pth_shared_area_t * pth_shared_area
 
intern size_t PTH_SHARED_SIZE
 
intern size_t PTH_MAX_SHARED_OBJECTS
 

Macro Definition Documentation

◆ PTH_COND_BOUNDED

#define PTH_COND_BOUNDED   _BIT(4)

Definition at line 839 of file pth_sync.c.

◆ SYNC_DEBUG_SHARED_INIT

#define SYNC_DEBUG_SHARED_INIT   1

Definition at line 55 of file pth_sync.c.

Function Documentation

◆ _pth_acquire()

static void _pth_acquire ( pth_qlock_t *  spinlock,
pid_t  tid 
)
inlinestatic

◆ _pth_cond_init()

int _pth_cond_init ( pth_cond_t *  cond,
int  pshared 
)

Definition at line 841 of file pth_sync.c.

References rfutex_init().

◆ _pth_release()

static void _pth_release ( pth_qlock_t *  spinlock,
pid_t  tid 
)
inlinestatic

◆ pth_alloc_shared_cond()

intern pth_cond_t* pth_alloc_shared_cond ( void  )

Definition at line 197 of file pth_sync.c.

References PTH_MAX_SHARED_OBJECTS, pth_shared_area, and PTH_SHARED_SIZE.

Referenced by pthread_cond_init().

◆ pth_alloc_shared_mutex()

intern pth_mutex_t* pth_alloc_shared_mutex ( void  )

Definition at line 173 of file pth_sync.c.

References PTH_MAX_SHARED_OBJECTS, pth_shared_area, and PTH_SHARED_SIZE.

Referenced by pth_rwlock_init(), and pthread_mutex_init().

◆ pth_barrier_init()

int pth_barrier_init ( pth_barrier_t *  barrier,
int  threshold 
)

Definition at line 1157 of file pth_sync.c.

References pth_mutex_init().

◆ pth_barrier_reach()

int pth_barrier_reach ( pth_barrier_t *  barrier)

◆ pth_check_waiters()

static int pth_check_waiters ( void *  arg)
static

Definition at line 1039 of file pth_sync.c.

Referenced by pth_cond_notify().

◆ pth_cond_await()

◆ pth_cond_cleanup_handler()

static void pth_cond_cleanup_handler ( void *  _cleanvec)
static

Definition at line 880 of file pth_sync.c.

◆ pth_cond_destroy()

int pth_cond_destroy ( pth_cond_t *  cond)

Definition at line 856 of file pth_sync.c.

References pth_shared_area, and rfutex_destroy().

Referenced by pthread_cond_destroy().

◆ pth_cond_notify()

◆ pth_find_shared_mutex()

intern int pth_find_shared_mutex ( pth_mutex_t *  mutex)

Definition at line 151 of file pth_sync.c.

References mutex, PTH_MAX_SHARED_OBJECTS, and pth_shared_area.

Referenced by pthread_cond_init(), and pthread_mutex_init().

◆ pth_initialize_shared()

intern int pth_initialize_shared ( void  )

◆ pth_mutex_acquire()

◆ pth_mutex_destroy()

int pth_mutex_destroy ( pth_mutex_t *  mutex)

Definition at line 695 of file pth_sync.c.

References futex_destroy(), mutex, and pth_shared_area.

Referenced by pth_rwlock_destroy(), pth_rwlock_init(), and pthread_mutex_destroy().

◆ pth_mutex_init()

int pth_mutex_init ( pth_mutex_t *  mutex,
pth_mutexattr_t *  pattr 
)

Definition at line 221 of file pth_sync.c.

References mutex, and rfutex_init().

Referenced by main(), pth_barrier_init(), pth_fork(), pth_rwlock_init(), and pthread_mutex_init().

◆ pth_mutex_release()

◆ pth_mutex_releaseall()

intern void pth_mutex_releaseall ( pth_t  thread)

Definition at line 663 of file pth_sync.c.

References pth_mutex_release(), and thread().

Referenced by pth_thread_cleanup().

◆ pth_rwlock_acquire()

int pth_rwlock_acquire ( pth_rwlock_t *  rwlock,
int  op,
int  tryonly,
pth_event_t  ev_extra 
)

◆ pth_rwlock_destroy()

int pth_rwlock_destroy ( pth_rwlock_t *  rwlock)

Definition at line 757 of file pth_sync.c.

References pth_free_mem(), and pth_mutex_destroy().

Referenced by pthread_rwlock_destroy().

◆ pth_rwlock_init()

int pth_rwlock_init ( pth_rwlock_t *  rwlock,
int  pshared 
)

Definition at line 724 of file pth_sync.c.

References pth_alloc_shared_mutex(), pth_malloc(), pth_mutex_destroy(), and pth_mutex_init().

Referenced by pthread_rwlock_init().

◆ pth_rwlock_release()

int pth_rwlock_release ( pth_rwlock_t *  rwlock)

Definition at line 804 of file pth_sync.c.

References pth_mutex_acquire(), and pth_mutex_release().

Referenced by pthread_rwlock_unlock().

◆ pth_shared_mutex_acquire()

int pth_shared_mutex_acquire ( pth_mutex_t *  mutex,
int  tryonly,
pth_event_t  ev_extra,
pth_descr_t  descr 
)

Variable Documentation

◆ PTH_MAX_SHARED_OBJECTS

intern size_t PTH_MAX_SHARED_OBJECTS

◆ pth_shared_area

intern pth_shared_area_t* pth_shared_area

◆ pth_shared_fd

intern int pth_shared_fd = 0

Definition at line 90 of file pth_sync.c.

Referenced by pth_initialize_shared().

◆ PTH_SHARED_SIZE

intern size_t PTH_SHARED_SIZE

Definition at line 92 of file pth_sync.c.

Referenced by pth_alloc_shared_cond(), pth_alloc_shared_mutex(), and pth_initialize_shared().