39 #include <sys/types.h>
51 #include "debug_lock.h"
52 #include "shm_arena.h"
54 #include "arena_lock.h"
85 arena = get_arena_and_autolock(arena, 2, &err IF_SPEW(, __func__));
119 arena = get_arena_and_autolock(arena, 1, &err IF_SPEW(, __func__));
122 return (errno = err);
150 arena = get_arena_and_autolock(arena, 0, &err IF_SPEW(, __func__));
152 return (errno = err);
184 arena = get_arena_and_autolock(arena, 1, &err IF_SPEW(, __func__));
189 if((l = ptr_rwlock(ptr)))
191 err = pthread_rwlock_wrlock(l);
196 "%s() failed: pthread_rwlock_wrlock() failed",
232 arena = get_arena_and_autolock(arena, 1, &err IF_SPEW(, __func__));
238 if((l = ptr_rwlock(ptr)))
240 err = pthread_rwlock_rdlock(l);
245 "%s() failed: pthread_rwlock_rdlock() failed",
275 arena = get_arena(arena, 1, &err IF_SPEW(, __func__));
281 if((l = ptr_rwlock(ptr)))
283 err = pthread_rwlock_unlock(l);
288 "%s() failed: pthread_rwlock_unlock() failed",
294 err = arena_autounlock(arena IF_SPEW(, __func__));
296 arena_autounlock(arena IF_SPEW(, __func__));
321 if(arena)
return err;
328 arena = get_arena_and_autolock(arena, 1, &err IF_SPEW(, __func__));
333 if((l = ptr_rwlock(ptr))
335 err = pthread_rwlock_rdlock(l);
340 "%s() failed: pthread_rwlock_rdlock() failed",
366 SPEW(_DEBUG,
"%s(arena=%p)", __func__, arena);
368 arena = get_arena(arena, 2, &err IF_SPEW(, __func__));
371 return (errno = err);
int shm_rwlock_reset(shm_arena_t arena, const void *ptr)
reset a segment read-write lock
int shm_arena_rdlock(shm_arena_t arena)
acquire an arena read lock
int shm_unlock(shm_arena_t arena, const void *ptr)
release a shared memory segment read-write lock
int shm_arena_wrlock(shm_arena_t arena)
acquire an arena write lock
int shm_arena_rwlock_reset(shm_arena_t arena)
reset an arena read-write lock
int shm_wrlock(shm_arena_t arena, const void *ptr)
acquire an segment write lock
int shm_arena_unlock(shm_arena_t arena)
release an arena read or write lock
int shm_rdlock(shm_arena_t arena, const void *ptr)
acquire an segment read lock