Shared pointer macros.
More...
Go to the source code of this file.
Shared pointer macros.
Definition in file shptr.h.
◆ YAZ_SHPTR_DEC
#define YAZ_SHPTR_DEC |
( |
|
p, |
|
|
|
destroy |
|
) |
| |
Value: { \
yaz_mutex_enter(p->mutex); \
if (--p->ref == 0) { \
yaz_mutex_leave(p->mutex); \
destroy(p->ptr); \
yaz_mutex_destroy(&p->mutex); \
xfree(p); \
p = 0; \
} else { \
yaz_mutex_leave(p->mutex); \
} \
}
Definition at line 64 of file shptr.h.
◆ YAZ_SHPTR_INC
#define YAZ_SHPTR_INC |
( |
|
p | ) |
|
Value: { \
yaz_mutex_enter(p->mutex); \
p->ref++; \
yaz_mutex_leave(p->mutex); \
}
Definition at line 58 of file shptr.h.
◆ YAZ_SHPTR_INIT
#define YAZ_SHPTR_INIT |
( |
|
p, |
|
|
|
n |
|
) |
| |
Value: { \
p->ptr = n; \
p->ref = 1; \
p->mutex = 0; \
yaz_mutex_create(&p->mutex); \
}
#define xmalloc(x)
utility macro which calls malloc_f
Definition at line 50 of file shptr.h.
◆ YAZ_SHPTR_TYPE
#define YAZ_SHPTR_TYPE |
( |
|
type | ) |
|
Value:
{ \
type ptr; \
int ref; \
YAZ_MUTEX mutex; \
}; \
typedef
struct type##_shptr *
type##_shptr_t;
Definition at line 41 of file shptr.h.