put

put 方法會將訊息新增至訊息佇列的結尾。

簽章
RiCOSResult RiCOSMessageQueue_put(
   RiCOSMessageQueue *const me, gen_ptr message,
   RiCBoolean fromISR);
參數
me

要將訊息新增至的 RiCOSMessageQueue

訊息

要新增至佇列的訊息

fromISR

布林值,判定要新增的訊息是否是從岔斷服務常式 (ISR) 產生的

傳回

RiCOSResult 物件,如 RiCOS*.h 檔案所定義

範例
RiCOSResult RiCOSMessageQueue_put(
   RiCOSMessageQueue * const me, gen_ptr message,
   RiCBoolean fromISR)
{
   static gen_ptr NULL_VAL = NULL;
   int timeout = WAIT_FOREVER;
   int priority = MSG_PRI_NORMAL;

   if (message == NULL) message = NULL_VAL;

   if (fromISR) {
      timeout = NO_WAIT;
      priority = MSG_PRI_URGENT;
   }
   return (msgQSend(me->hVxMQ, (char*)&message,
      sizeof(message), timeout, priority) == OK);
}

意見回饋