design_pattern_for_c  V 1.00
dp_mutex.h File Reference

Utility mutex API for design pattern. More...

#include <pthread.h>
Include dependency graph for dp_mutex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Lock/Unlock API

#define DPUTIL_LOCK(lock)
 lock macro, to care pthread_cancel More...
 
#define DPUTIL_UNLOCK   pthread_cleanup_pop(1);
 unlock macro, to care pthread_cancel More...
 
void dputil_lock (void *handle)
 lock More...
 
void dputil_unlock (void *handle)
 unlock More...
 

Detailed Description

Utility mutex API for design pattern.

Definition in file dp_mutex.h.

Macro Definition Documentation

◆ DPUTIL_LOCK

#define DPUTIL_LOCK (   lock)
Value:
dputil_lock(lock);\
pthread_cleanup_push(dputil_unlock, lock);
void dputil_unlock(void *handle)
unlock
Definition: dp_util.c:14
void dputil_lock(void *handle)
lock
Definition: dp_util.c:7

lock macro, to care pthread_cancel

Definition at line 15 of file dp_mutex.h.

◆ DPUTIL_UNLOCK

#define DPUTIL_UNLOCK   pthread_cleanup_pop(1);

unlock macro, to care pthread_cancel

Definition at line 19 of file dp_mutex.h.

Function Documentation

◆ dputil_lock()

void dputil_lock ( void *  handle)

lock

Definition at line 7 of file dp_util.c.

◆ dputil_unlock()

void dputil_unlock ( void *  handle)

unlock

Definition at line 14 of file dp_util.c.