#include <stdio.h>
#include <stdlib.h>
#include "../include/macros.h"
#include "../include/rwlock.h"
Go to the source code of this file.
Data Structures | |
struct | listNode_s |
struct | list_s |
Typedefs | |
typedef int(* | ListSearchFunc_t )(const void *key, void *element) |
typedef void *(* | ListElemCopyFunc_t )(const void *src) |
typedef int(* | ListElemDestroyFunc_t )(void *elem) |
typedef int(* | ListElemGenericFunc_t )(void *elem) |
typedef struct listNode_s | listNode_t |
typedef listNode_t * | listNode_p |
typedef struct list_s | list_t |
typedef list_t * | list_p |
Functions | |
list_p | ListInitialize (void) |
void | ListTerminate (list_p list) |
void | ListClearCB (list_p list, ListElemDestroyFunc_t cb) |
int | ListGetSize (list_p list) |
int | ListAdd (list_p list, void *data) |
int | ListAppend (list_p list, void *data) |
int | ListInsert (list_p list, void *data, const int index) |
list_p | ListCopy (list_p list, void *(*data_copy_callback)(const void *data)) |
void * | ListGetHead (list_p list) |
void * | ListPop (list_p list) |
void * | ListSearch (list_p list, const int index) |
void * | ListDelete (list_p list, const int index) |
void * | ListSearchCB (list_p list, const void *key, ListSearchFunc_t cb) |
void * | ListDeleteCB (list_p list, const void *key, ListSearchFunc_t cb) |
void | ListWait (list_p list) |
int | ListForEachCB (list_p list, ListElemGenericFunc_t cb) |
void | ListRDLock (list_p list) |
void | ListRDUnlock (list_p list) |
void | ListWRLock (list_p list) |
void | ListWRUnlock (list_p list) |
void | ListWRWait (list_p list) |
void | ListRDWait (list_p list) |
void | ListRDtoWR (list_p list) |
void | ListWRtoRD (list_p list) |
typedef void*(* ListElemCopyFunc_t)(const void *src) |
typedef int(* ListElemDestroyFunc_t)(void *elem) |
typedef int(* ListElemGenericFunc_t)(void *elem) |
typedef listNode_t* listNode_p |
typedef struct listNode_s listNode_t |
typedef int(* ListSearchFunc_t)(const void *key, void *element) |
int ListAdd | ( | list_p | list, | |
void * | data | |||
) |
Definition at line 185 of file list.c.
References list_s::listhead, listNode_s::next, listNode_s::node_data, and list_s::size.
Referenced by acc_connection_Thread(), acc_MessageHandlerThread(), agent_AddPersistentVariable(), agent_Destroy(), agent_RunChScriptThread(), agent_task_Copy(), agent_xml_parse__data(), agent_xml_parse__file(), ams_ManageAgentList(), df_Add(), df_AddRequest(), listen_Thread(), MC_AclPost(), MC_AddAgent(), MC_AddStationaryAgent(), MC_AgentAttachFile(), MC_BarrierInit(), MC_LoadAgentFromFile(), mc_platform_Initialize(), MC_SaveData_chdl(), MC_SendAgent(), MC_SendAgentFile(), MC_SendAgentMigrationMessage(), MC_SendAgentMigrationMessageFile(), and syncListAddNode().
int ListAppend | ( | list_p | list, | |
void * | data | |||
) |
Definition at line 221 of file list.c.
References list_s::listhead, listNode_s::next, listNode_s::node_data, and list_s::size.
Referenced by ListCopy().
void ListClearCB | ( | list_p | list, | |
ListElemDestroyFunc_t | cb | |||
) |
Definition at line 72 of file list.c.
References ListPop().
Referenced by agent_Destroy(), agent_RunChScriptThread(), agent_task_Destroy(), handler_FLUSH_AGENTS(), and mc_platform_Destroy().
Definition at line 257 of file list.c.
References ListAppend(), list_s::listhead, ListInitialize(), listNode_s::next, and listNode_s::node_data.
Referenced by agent_task_Copy().
void* ListDelete | ( | list_p | list, | |
const int | index | |||
) |
Definition at line 272 of file list.c.
References list_s::listhead, listNode_s::next, listNode_s::node_data, and list_s::size.
Referenced by ams_ManageAgentList(), and message_queue_SendOutgoing().
void* ListDeleteCB | ( | list_p | list, | |
const void * | key, | |||
ListSearchFunc_t | cb | |||
) |
Definition at line 362 of file list.c.
References list_s::listhead, listNode_s::next, listNode_s::node_data, and list_s::size.
Referenced by agent_AddPersistentVariable(), MC_BarrierDelete(), MC_DeleteAgent(), MC_DeleteAgentWG(), syncListDelete(), and syncListRemove().
int ListForEachCB | ( | list_p | list, | |
ListElemGenericFunc_t | cb | |||
) |
Definition at line 408 of file list.c.
References list_s::listhead, listNode_s::next, and listNode_s::node_data.
Referenced by ams_Print(), handler_PRINT_CONNECTLIST(), handler_PRINTLIST_AGENTS(), and handler_PRINTLIST_MESSAGE().
void* ListGetHead | ( | list_p | list | ) |
Definition at line 92 of file list.c.
References list_s::listhead, and listNode_s::node_data.
int ListGetSize | ( | list_p | list | ) |
Definition at line 85 of file list.c.
References list_s::size.
Referenced by acc_Thread(), ams_Print(), MC_AgentListFiles(), MC_GetAllAgents(), MC_GetNumAgents(), MC_WaitAgent(), and MC_WaitRetrieveAgent().
list_p ListInitialize | ( | void | ) |
Definition at line 34 of file list.c.
References list_s::listhead, list_s::rwlock, rwlock_New(), and list_s::size.
Referenced by agent_Copy(), agent_Initialize(), agent_New(), agent_NewBinary(), agent_task_Copy(), agent_task_New(), df_Initialize(), ListCopy(), and mc_platform_Initialize().
void* ListPop | ( | list_p | list | ) |
Definition at line 104 of file list.c.
References list_s::listhead, listNode_s::next, listNode_s::node_data, and list_s::size.
Referenced by acc_MessageHandlerThread(), acc_Thread(), agent_xml_compose__task(), df_Destroy(), df_ProcessRequest(), df_request_list_Destroy(), interpreter_queue_CreateRetrieve(), ListClearCB(), MC_AclRetrieve(), MC_AclWaitRetrieve(), and mc_platform_Destroy().
void ListRDLock | ( | list_p | list | ) |
Definition at line 422 of file list.c.
References list_s::rwlock, and rwlock_rdlock().
Referenced by acc_connection_Thread(), acc_Thread(), agent_task_Copy(), ams_ManageAgentList(), ams_Print(), df_Thread(), handler_PRINT_CONNECTLIST(), handler_PRINTLIST_AGENTS(), handler_PRINTLIST_MESSAGE(), MC_AgentListFiles(), MC_AgentRetrieveFile(), MC_AgentVariableRetrieve(), MC_AgentVariableRetrieveInfo(), MC_Barrier(), MC_BarrierInit(), MC_CondBroadcast(), MC_CondReset(), MC_CondSignal(), MC_CondWait(), MC_FindAgentByID(), MC_FindAgentByName(), MC_GetAgents(), MC_GetAllAgents(), MC_GetNumAgents(), MC_MutexLock(), MC_MutexUnlock(), MC_QueueRDLock(), MC_RetrieveAgent(), MC_SemaphorePost(), MC_SemaphoreWait(), MC_WaitAgent(), MC_WaitRetrieveAgent(), and message_queue_SendOutgoing().
void ListRDtoWR | ( | list_p | list | ) |
Definition at line 456 of file list.c.
References COND_WAIT, rwlock_s::lock, MUTEX_LOCK, rwlock_s::readers, list_s::rwlock, and rwlock_s::writer_cond.
Referenced by acc_Thread(), ams_ManageAgentList(), and message_queue_SendOutgoing().
void ListRDUnlock | ( | list_p | list | ) |
Definition at line 427 of file list.c.
References list_s::rwlock, and rwlock_rdunlock().
Referenced by acc_connection_Thread(), acc_Thread(), agent_task_Copy(), ams_ManageAgentList(), ams_Print(), df_Thread(), handler_PRINT_CONNECTLIST(), handler_PRINTLIST_AGENTS(), handler_PRINTLIST_MESSAGE(), MC_AgentListFiles(), MC_AgentRetrieveFile(), MC_AgentVariableRetrieve(), MC_AgentVariableRetrieveInfo(), MC_Barrier(), MC_BarrierInit(), MC_CondBroadcast(), MC_CondReset(), MC_CondSignal(), MC_CondWait(), MC_FindAgentByID(), MC_FindAgentByName(), MC_GetAgents(), MC_GetAllAgents(), MC_GetNumAgents(), MC_MutexLock(), MC_MutexUnlock(), MC_QueueRDUnlock(), MC_RetrieveAgent(), MC_SemaphorePost(), MC_SemaphoreWait(), MC_WaitAgent(), MC_WaitRetrieveAgent(), and message_queue_SendOutgoing().
void ListRDWait | ( | list_p | list | ) |
Definition at line 447 of file list.c.
References COND_WAIT, rwlock_s::lock, MUTEX_LOCK, MUTEX_UNLOCK, rwlock_s::reader_cond, rwlock_s::readers, and list_s::rwlock.
Referenced by acc_Thread(), df_Thread(), and MC_WaitAgent().
void* ListSearch | ( | list_p | list, | |
const int | index | |||
) |
Definition at line 139 of file list.c.
References list_s::listhead, listNode_s::next, listNode_s::node_data, and list_s::size.
Referenced by agent_task_Copy(), ams_ManageAgentList(), MC_AgentListFiles(), MC_GetAgents(), MC_GetAllAgents(), MC_RetrieveAgent(), MC_WaitRetrieveAgent(), and message_queue_SendOutgoing().
void* ListSearchCB | ( | list_p | list, | |
const void * | key, | |||
ListSearchFunc_t | cb | |||
) |
Definition at line 319 of file list.c.
References list_s::listhead, listNode_s::next, listNode_s::node_data, and list_s::size.
Referenced by acc_connection_Thread(), acc_MessageHandlerThread(), MC_AgentRetrieveFile(), MC_AgentVariableRetrieve(), MC_AgentVariableRetrieveInfo(), MC_Barrier(), MC_BarrierInit(), MC_CondBroadcast(), MC_CondReset(), MC_CondSignal(), MC_CondWait(), MC_FindAgentByID(), MC_FindAgentByName(), MC_MutexLock(), MC_MutexUnlock(), MC_SemaphorePost(), MC_SemaphoreWait(), MC_SyncInit(), and syncListAddNode().
void ListTerminate | ( | list_p | list | ) |
Definition at line 51 of file list.c.
References list_s::listhead, list_s::rwlock, rwlock_Destroy(), and list_s::size.
Referenced by agent_Destroy(), agent_task_Destroy(), df_Destroy(), df_request_list_Destroy(), and mc_platform_Destroy().
void ListWait | ( | list_p | list | ) |
Definition at line 403 of file list.c.
References list_s::rwlock, and rwlock_rdwait().
void ListWRLock | ( | list_p | list | ) |
Definition at line 432 of file list.c.
References list_s::rwlock, and rwlock_wrlock().
Referenced by acc_connection_Thread(), acc_MessageHandlerThread(), agent_AddPersistentVariable(), agent_Destroy(), agent_RunChScriptThread(), agent_task_Copy(), agent_task_Destroy(), agent_xml_compose__task(), agent_xml_parse__data(), agent_xml_parse__file(), ams_ManageAgentList(), df_Add(), df_AddRequest(), df_Destroy(), df_ProcessRequest(), df_request_list_Destroy(), handler_FLUSH_AGENTS(), interpreter_queue_CreateRetrieve(), listen_Thread(), MC_AclPost(), MC_AclRetrieve(), MC_AclWaitRetrieve(), MC_AddAgent(), MC_AddStationaryAgent(), MC_AgentAttachFile(), MC_AgentProcessingBegin(), MC_BarrierDelete(), MC_BarrierInit(), MC_DeleteAgent(), MC_DeleteAgentWG(), MC_End(), MC_LoadAgentFromFile(), mc_platform_Destroy(), mc_platform_Initialize(), MC_QueueWRLock(), MC_SaveData_chdl(), MC_SendAgent(), MC_SendAgentFile(), MC_SendAgentMigrationMessage(), MC_SendAgentMigrationMessageFile(), and MC_SyncInit().
void ListWRtoRD | ( | list_p | list | ) |
Definition at line 465 of file list.c.
References rwlock_s::lock, MUTEX_UNLOCK, rwlock_s::readers, and list_s::rwlock.
Referenced by ams_ManageAgentList(), and message_queue_SendOutgoing().
void ListWRUnlock | ( | list_p | list | ) |
Definition at line 437 of file list.c.
References list_s::rwlock, and rwlock_wrunlock().
Referenced by acc_connection_Thread(), acc_MessageHandlerThread(), acc_Thread(), agent_AddPersistentVariable(), agent_Destroy(), agent_RunChScriptThread(), agent_task_Copy(), agent_task_Destroy(), agent_xml_compose__task(), agent_xml_parse__data(), agent_xml_parse__file(), ams_ManageAgentList(), df_Add(), df_AddRequest(), df_Destroy(), df_ProcessRequest(), df_request_list_Destroy(), handler_FLUSH_AGENTS(), interpreter_queue_CreateRetrieve(), listen_Thread(), MC_AclPost(), MC_AclRetrieve(), MC_AclWaitRetrieve(), MC_AddAgent(), MC_AddStationaryAgent(), MC_AgentAttachFile(), MC_AgentProcessingEnd(), MC_BarrierDelete(), MC_BarrierInit(), MC_DeleteAgent(), MC_DeleteAgentWG(), MC_End(), MC_LoadAgentFromFile(), mc_platform_Destroy(), mc_platform_Initialize(), MC_QueueWRUnlock(), MC_SaveData_chdl(), MC_SendAgent(), MC_SendAgentFile(), MC_SendAgentMigrationMessage(), MC_SendAgentMigrationMessageFile(), and MC_SyncInit().
void ListWRWait | ( | list_p | list | ) |
Definition at line 442 of file list.c.
References COND_WAIT, rwlock_s::lock, rwlock_s::reader_cond, and list_s::rwlock.
Referenced by acc_MessageHandlerThread(), and MC_AclWaitRetrieve().