Browse Source

Remove option of using precarious intermediate variants of cklocks

master
Con Kolivas 10 years ago
parent
commit
431234a3d6
  1. 26
      src/libckpool.c
  2. 4
      src/libckpool.h

26
src/libckpool.c

@ -337,25 +337,6 @@ void _ck_rlock(cklock_t *lock, const char *file, const char *func, const int lin
_mutex_unlock(&lock->mutex, file, func, line); _mutex_unlock(&lock->mutex, file, func, line);
} }
/* Intermediate variant of cklock - behaves as a read lock but can be promoted
* to a write lock or demoted to read lock. */
void _ck_ilock(cklock_t *lock, const char *file, const char *func, const int line)
{
_mutex_lock(&lock->mutex, file, func, line);
}
/* Unlock intermediate variant without changing to read or write version */
void _ck_uilock(cklock_t *lock, const char *file, const char *func, const int line)
{
_mutex_unlock(&lock->mutex, file, func, line);
}
/* Upgrade intermediate variant to a write lock */
void _ck_ulock(cklock_t *lock, const char *file, const char *func, const int line)
{
_wr_lock(&lock->rwlock, file, func, line);
}
/* Write lock variant of cklock */ /* Write lock variant of cklock */
void _ck_wlock(cklock_t *lock, const char *file, const char *func, const int line) void _ck_wlock(cklock_t *lock, const char *file, const char *func, const int line)
{ {
@ -377,13 +358,6 @@ void _ck_dwilock(cklock_t *lock, const char *file, const char *func, const int l
_wr_unlock(&lock->rwlock, file, func, line); _wr_unlock(&lock->rwlock, file, func, line);
} }
/* Downgrade intermediate variant to a read lock */
void _ck_dlock(cklock_t *lock, const char *file, const char *func, const int line)
{
_rd_lock(&lock->rwlock, file, func, line);
_mutex_unlock(&lock->mutex, file, func, line);
}
void _ck_runlock(cklock_t *lock, const char *file, const char *func, const int line) void _ck_runlock(cklock_t *lock, const char *file, const char *func, const int line)
{ {
_rd_unlock(&lock->rwlock, file, func, line); _rd_unlock(&lock->rwlock, file, func, line);

4
src/libckpool.h

@ -166,12 +166,8 @@ static inline void flip_80(void *dest_p, const void *src_p)
#define cklock_init(_lock) _cklock_init(_lock, __FILE__, __func__, __LINE__) #define cklock_init(_lock) _cklock_init(_lock, __FILE__, __func__, __LINE__)
#define ck_rlock(_lock) _ck_rlock(_lock, __FILE__, __func__, __LINE__) #define ck_rlock(_lock) _ck_rlock(_lock, __FILE__, __func__, __LINE__)
#define ck_ilock(_lock) _ck_ilock(_lock, __FILE__, __func__, __LINE__)
#define ck_uilock(_lock) _ck_uilock(_lock, __FILE__, __func__, __LINE__)
#define ck_ulock(_lock) _ck_ulock(_lock, __FILE__, __func__, __LINE__)
#define ck_wlock(_lock) _ck_wlock(_lock, __FILE__, __func__, __LINE__) #define ck_wlock(_lock) _ck_wlock(_lock, __FILE__, __func__, __LINE__)
#define ck_dwlock(_lock) _ck_dwlock(_lock, __FILE__, __func__, __LINE__) #define ck_dwlock(_lock) _ck_dwlock(_lock, __FILE__, __func__, __LINE__)
#define ck_dwilock(_lock) _ck_dwilock(_lock, __FILE__, __func__, __LINE__)
#define ck_dlock(_lock) _ck_dlock(_lock, __FILE__, __func__, __LINE__) #define ck_dlock(_lock) _ck_dlock(_lock, __FILE__, __func__, __LINE__)
#define ck_runlock(_lock) _ck_runlock(_lock, __FILE__, __func__, __LINE__) #define ck_runlock(_lock) _ck_runlock(_lock, __FILE__, __func__, __LINE__)
#define ck_wunlock(_lock) _ck_wunlock(_lock, __FILE__, __func__, __LINE__) #define ck_wunlock(_lock) _ck_wunlock(_lock, __FILE__, __func__, __LINE__)

Loading…
Cancel
Save