33 #ifndef YAZ_SHARED_PTR_H
34 #define YAZ_SHARED_PTR_H
41 #define YAZ_SHPTR_TYPE(type) \
48 typedef struct type##_shptr *type##_shptr_t;
50 #define YAZ_SHPTR_INIT(p,n) { \
51 p = xmalloc(sizeof(*p)); \
55 yaz_mutex_create(&p->mutex); \
58 #define YAZ_SHPTR_INC(p) { \
59 yaz_mutex_enter(p->mutex); \
61 yaz_mutex_leave(p->mutex); \
64 #define YAZ_SHPTR_DEC(p, destroy) { \
65 yaz_mutex_enter(p->mutex); \
66 if (--p->ref == 0) { \
67 yaz_mutex_leave(p->mutex); \
69 yaz_mutex_destroy(&p->mutex); \
73 yaz_mutex_leave(p->mutex); \
Header for Mutex functions.
Header for memory handling functions.