Beispiel #1
0
IPC_RETURN_TYPE IPC_setMsgQueueLength (const char *msgName, int queueLength)
{
  MSG_PTR msg;

  if (queueLength < 1) {
    RETURN_ERROR(IPC_Argument_Out_Of_Range);
  } else if (!X_IPC_CONNECTED()) {
    RETURN_ERROR(IPC_Not_Connected);
  } else {
    msg = x_ipc_findOrRegisterMessage(msgName);
    msg->limit = queueLength;
    LOCK_M_MUTEX;
    x_ipcLimitPendingMessages(msgName, GET_M_GLOBAL(modNameGlobal), 
			      queueLength);
    UNLOCK_M_MUTEX;
    return IPC_OK;
  }
}
Beispiel #2
0
void _x_ipcWatchVar(const char *varName, const char *format, X_IPC_HND_FN watchFn)
{
#ifdef UNUSED_PRAGMA
#pragma unused(format)
#endif
  char *watchMsgName;
  
  watchMsgName = (char *)x_ipcMalloc(1+strlen(varName)+strlen(VAR_WATCH_PREFIX));
  strcpy(watchMsgName,VAR_WATCH_PREFIX);
  strcat(watchMsgName,varName);
  
  /* Check to see if already registered */
  LOCK_CM_MUTEX; 
  HND_KEY_TYPE hndKey; hndKey.num = 0; hndKey.str = watchMsgName;
  HND_PTR watchMsgHnd = GET_HANDLER(&hndKey);
  UNLOCK_CM_MUTEX;
  if (watchMsgHnd == NULL || watchMsgHnd->msg == NULL) {
    /* Register the tap messages and handler */
    x_ipcRegisterHandler(watchMsgName,watchMsgName,watchFn);
    x_ipcLimitPendingMessages(watchMsgName, GET_M_GLOBAL(modNameGlobal), 1);
  }
  x_ipcFree(watchMsgName);
}