Example #1
0
void x_ipcRefFree(X_IPC_REF_PTR x_ipcRef)
{
  if (x_ipcRef) {
    x_ipcRef->refId = 0;
    x_ipcRef->msg = NULL;

    x_ipcFree((char *)x_ipcRef->name);
    x_ipcRef->name = NULL;

    LOCK_CM_MUTEX;
    x_ipc_listInsertItemFirst((char *)x_ipcRef, GET_C_GLOBAL(x_ipcRefFreeList));
    UNLOCK_CM_MUTEX;
  }
}
Example #2
0
void x_ipc_listInsertItemAfter(const void *item, void *after, LIST_PTR list)
{
  LIST_ELEM_PTR element, tmp;
  
  if (!item || !list)
    return;
  
  LOCK_LIST_MUTEX;
  if (!after) {
    x_ipc_listInsertItemFirst(item, list);
    UNLOCK_LIST_MUTEX;
    return;
  }
  
  tmp = list->first;
  
  while (tmp && tmp->item != after) 
    tmp = tmp->next;
  
  if (!tmp || (tmp == list->last)) {
    x_ipc_listInsertItemLast(item, list);
    UNLOCK_LIST_MUTEX;
    return;
  }
  
  /* No need to lock M_MUTEX, since list.c is only place this is accessed */
  if (!GET_M_GLOBAL(listCellFreeListGlobal))
    x_ipc_listIncCellFreeList();
  
  element = GET_M_GLOBAL(listCellFreeListGlobal);
  GET_M_GLOBAL(listCellFreeListGlobal) = 
    GET_M_GLOBAL(listCellFreeListGlobal)->next;
  
  element->item = (const char *)item;
  element->next = tmp->next;
  element->previous = tmp;
  
  tmp->next = element;
  
  list->length++;
  UNLOCK_LIST_MUTEX;
}
Example #3
0
void x_ipc_listInsertItem(const void *item, LIST_PTR list)
{
  x_ipc_listInsertItemFirst(item, list);
}
Example #4
0
static int32 x_ipc_listCopyInsert(LIST_PTR list, const void *item)
{
  x_ipc_listInsertItemFirst(item , list);
  
  return 1;
}