nfs-ganesha 1.4
|
00001 /* 00002 * RW_Lock.h 00003 * 00004 * This file contains the defintions of the functions and types for the RW lock management 00005 * 00006 * $Header: /cea/home/cvs/cvs/SHERPA/BaseCvs/GANESHA/src/RW_Lock/RW_Lock.h,v 1.1 2004/08/16 09:35:08 deniel Exp $ 00007 * 00008 * $Log: RW_Lock.h,v $ 00009 * Revision 1.1 2004/08/16 09:35:08 deniel 00010 * Population de la repository avec les Hashtables et les RW_Lock 00011 * 00012 * Revision 1.5 2003/12/19 16:31:52 deniel 00013 * Resolution du pb de deadlock avec des variables de conditions 00014 * 00015 * Revision 1.4 2003/12/19 13:18:57 deniel 00016 * Identification du pb de deadlock: on ne peux pas unlocker deux fois de suite 00017 * 00018 * Revision 1.3 2003/12/18 14:15:37 deniel 00019 * Correction d'un probleme lors de la declaration des init de threads 00020 * 00021 * Revision 1.1.1.1 2003/12/17 10:29:49 deniel 00022 * Recreation de la base 00023 * 00024 * 00025 * Revision 1.1 2003/12/17 09:34:43 deniel 00026 * Header file added to the repository 00027 * 00028 * 00029 */ 00030 00031 #ifndef _RW_LOCK_H 00032 #define _RW_LOCK_H 00033 00034 #include <pthread.h> 00035 #include "log.h" 00036 #include "common_utils.h" 00037 00038 00039 /* Type representing the lock itself */ 00040 typedef struct _RW_LOCK 00041 { 00042 unsigned int nbr_active; 00043 unsigned int nbr_waiting; 00044 unsigned int nbw_active; 00045 unsigned int nbw_waiting; 00046 pthread_mutex_t mutexProtect; 00047 pthread_cond_t condWrite; 00048 pthread_cond_t condRead; 00049 } rw_lock_t; 00050 00051 int rw_lock_init(rw_lock_t * plock); 00052 int rw_lock_destroy(rw_lock_t * plock); 00053 int P_w(rw_lock_t * plock); 00054 int V_w(rw_lock_t * plock); 00055 int P_r(rw_lock_t * plock); 00056 int V_r(rw_lock_t * plock); 00057 int rw_lock_downgrade(rw_lock_t * plock); 00058 int rw_lock_upgrade(rw_lock_t * plock); 00059 00060 #endif /* _RW_LOCK */