XROAD
xroad_lock.h File Reference
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for xroad_lock.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  xroad_lock_t
 

Macros

#define __xroad_lock_unlock_dtor__   __attribute__((__cleanup__(xroad_lock_unlock_dtor)))
 

Functions

void xroad_lock_lock (xroad_lock_t *l)
 
void xroad_lock_lock_ex (xroad_lock_t *l, uint32_t locker_id)
 
bool xroad_lock_unlock (xroad_lock_t *l)
 
bool xroad_lock_unlock_ex (xroad_lock_t *l, uint32_t locker_id)
 Release lock assuming it belongs to locker_id.
 
void xroad_lock_reset (xroad_lock_t *l)
 
void xroad_lock_unlock_dtor (xroad_lock_t **l_ptr)
 
int32_t xroad_lock_get_version (const xroad_lock_t *l)
 Get lock version (generation)
 
int32_t xroad_lock_get_pid (const xroad_lock_t *l)
 Get pid of the process holding the lock.
 
int32_t xroad_lock_number_lock (const xroad_lock_t *l)
 Get the number (depth) of locks held by the owning process (recursive lock)
 

Detailed Description

Function Documentation

◆ xroad_lock_lock_ex()

void xroad_lock_lock_ex ( xroad_lock_t *  l,
uint32_t  locker_id 
)

agressively acuires lock and set locker_id (as pid)

Parameters
[in]l- lock
[in]locker_id- it could be PID or some other type of locker ID (e.g. record ID in the lock_by_pid table)