00001 /* SVN FILE INFO 00002 * $Revision: 174 $ : Last Committed Revision 00003 * $Date: 2008-06-24 10:50:29 -0700 (Tue, 24 Jun 2008) $ : Last Committed Date */ 00004 /* CondList is a list of condition variables. Agents may set their own 00005 * condition variables, which other entities (agents, binary api) may signal. 00006 * */ 00007 00008 #ifndef _COND_LIST_H_ 00009 #define _COND_LIST_H_ 00010 #include "../include/macros.h" 00011 #include "../mc_list/list.h" 00012 #include "../include/mc_rwlock.h" 00013 00014 /* CondlistNode_t */ 00015 00016 typedef struct syncListNode_s { 00017 MUTEX_T *lock; 00018 COND_T *cond; 00019 SEMAPHORE_T *sem; 00020 int id; 00021 int signalled; 00022 }syncListNode_t; 00023 typedef syncListNode_t* syncListNode_p; 00024 00025 /* CondList */ 00026 typedef struct syncList_s { 00027 RWLOCK_T *lock; /* Protects the list */ 00028 MUTEX_T *giant_lock; /* Higher level lock: used to protect series 00029 of list operations */ 00030 list_p list; 00031 int size; 00032 }syncList_t; 00033 typedef syncList_t* syncList_p; 00034 00035 int syncListNodeInit(struct syncListNode_s *node); 00036 int syncListNodeDestroy(struct syncListNode_s *node); 00037 syncListNode_t *syncListFind(int id, struct syncList_s *list); 00038 struct syncListNode_s* syncListNodeNew(void); 00039 00040 int syncListDelete(int id, struct syncList_s *list); 00041 syncListNode_t* syncListRemove(int id, struct syncList_s *list); 00042 struct syncList_s* syncListInit(void); 00043 int syncListDestroy(struct syncList_s* list); 00044 int syncListAddNode(struct syncListNode_s *node, struct syncList_s *list); 00045 int syncListNew(int id, struct syncList_s *list); 00046 syncListNode_t* syncListGet(int id, struct syncList_s *list); 00047 00048 00049 #endif