#ifndef lf_hfs_locks_h
#define lf_hfs_locks_h
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <pthread.h>
typedef enum
{
LCK_RW_TYPE_SHARED,
LCK_RW_TYPE_EXCLUSIVE
} lck_rwlock_type_e;
typedef uint8_t lck_attr_t;
typedef uint8_t lck_grp_attr_t;
typedef uint8_t lck_grp_t;
void lf_lck_rw_init ( pthread_rwlock_t* lck );
void lf_lck_rw_destroy ( pthread_rwlock_t* lck );
void lf_lck_rw_unlock_shared ( pthread_rwlock_t* lck );
void lf_lck_rw_lock_shared ( pthread_rwlock_t* lck );
void lf_lck_rw_lock_exclusive ( pthread_rwlock_t* lck );
void lf_lck_rw_unlock_exclusive ( pthread_rwlock_t* lck );
bool lf_lck_rw_try_lock ( pthread_rwlock_t* lck, lck_rwlock_type_e which );
void lf_lck_rw_lock_exclusive_to_shared ( pthread_rwlock_t* lck);
bool lf_lck_rw_lock_shared_to_exclusive ( pthread_rwlock_t* lck);
void lf_lck_mtx_init ( pthread_mutex_t* lck );
void lf_lck_mtx_destroy ( pthread_mutex_t *lck );
void lf_lck_mtx_lock ( pthread_mutex_t* lck );
void lf_lck_mtx_unlock ( pthread_mutex_t* lck );
void lf_lck_mtx_lock_spin ( pthread_mutex_t *lck );
int lf_lck_mtx_try_lock ( pthread_mutex_t *lck );
void lf_lck_mtx_convert_spin ( pthread_mutex_t *lck );
void lf_cond_destroy( pthread_cond_t* cond );
void lf_cond_init( pthread_cond_t* cond );
int lf_cond_wait_relative(pthread_cond_t *pCond, pthread_mutex_t *pMutex, struct timespec *pTime);
void lf_cond_wakeup(pthread_cond_t *pCond);
void lf_lck_spin_init ( pthread_mutex_t *lck );
void lf_lck_spin_destroy ( pthread_mutex_t *lck );
void lf_lck_spin_lock ( pthread_mutex_t *lck );
void lf_lck_spin_unlock ( pthread_mutex_t *lck );
lck_attr_t *lf_lck_attr_alloc_init ( void );
lck_grp_attr_t *lf_lck_grp_attr_alloc_init ( void );
lck_grp_t *lf_lck_grp_alloc_init ( void );
#endif