|
|
@ -123,13 +123,6 @@ MSG_Q_ID msgQCreate (int maxMsgs, int maxMsgLength, int options) |
|
|
|
return (LW_NULL); |
|
|
|
} |
|
|
|
|
|
|
|
qid->wrSync = API_SemaphoreBCreate("vxWorks MsgQWr", LW_TRUE, ulOpt, LW_NULL); |
|
|
|
if (qid->syMsgq == LW_OBJECT_HANDLE_INVALID) { |
|
|
|
API_MsgQueueDelete(&qid->syMsgq); |
|
|
|
free(qid); |
|
|
|
return (LW_NULL); |
|
|
|
} |
|
|
|
|
|
|
|
return (qid); |
|
|
|
} |
|
|
|
|
|
|
@ -147,7 +140,6 @@ STATUS msgQDelete (MSG_Q_ID msgQId) |
|
|
|
return (ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
API_SemaphoreBDelete(&msgQId->wrSync); |
|
|
|
free(msgQId); |
|
|
|
|
|
|
|
return (OK); |
|
|
@ -166,36 +158,19 @@ STATUS msgQSend (MSG_Q_ID msgQId, char *buffer, UINT nBytes, |
|
|
|
return (ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
for (;;) { |
|
|
|
if (priority == MSG_PRI_URGENT) { |
|
|
|
ulError = API_MsgQueueSendEx(msgQId->syMsgq, buffer, nBytes, LW_OPTION_URGENT); |
|
|
|
|
|
|
|
ulError = API_MsgQueueSendEx2(msgQId->syMsgq, buffer, nBytes, |
|
|
|
vx2syMsgQTo(timeout), LW_OPTION_URGENT); |
|
|
|
} else { |
|
|
|
ulError = API_MsgQueueSend(msgQId->syMsgq, buffer, nBytes); |
|
|
|
ulError = API_MsgQueueSend2(msgQId->syMsgq, buffer, nBytes, vx2syMsgQTo(timeout)); |
|
|
|
} |
|
|
|
|
|
|
|
if (ulError == ERROR_NONE) { |
|
|
|
return (OK); |
|
|
|
|
|
|
|
} else if (ulError != ERROR_MSGQUEUE_FULL) { |
|
|
|
return (ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
if (API_InterGetNesting()) { |
|
|
|
errno = ERROR_MSGQUEUE_FULL; |
|
|
|
return (ERROR); |
|
|
|
|
|
|
|
} else { |
|
|
|
ulError = API_SemaphoreBPend(msgQId->wrSync, vx2syMsgQTo(timeout)); |
|
|
|
} |
|
|
|
|
|
|
|
if (ulError) { |
|
|
|
errno = ERROR_MSGQUEUE_FULL; |
|
|
|
return (ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return (ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
@ -217,8 +192,8 @@ int msgQReceive (MSG_Q_ID msgQId, char *buffer, UINT maxNBytes, int timeout) |
|
|
|
errno = S_objLib_OBJ_UNAVAILABLE; |
|
|
|
} |
|
|
|
return (ERROR); |
|
|
|
|
|
|
|
} else { |
|
|
|
API_SemaphoreBPost(msgQId->wrSync); |
|
|
|
return (OK); |
|
|
|
} |
|
|
|
} |
|
|
@ -253,6 +228,7 @@ STATUS msgQInfoGet (MSG_Q_ID msgQId, MSG_Q_INFO *pInfo) |
|
|
|
if (ulError) { |
|
|
|
errno = S_objLib_OBJ_UNAVAILABLE; |
|
|
|
return (ERROR); |
|
|
|
|
|
|
|
} else { |
|
|
|
pInfo->maxMsgLength = (int)stMaxMsgLen; |
|
|
|
pInfo->maxMsgs = (int)ulMaxMsgNum; |
|
|
@ -282,6 +258,7 @@ int msgQNumMsgs (MSG_Q_ID msgQId) |
|
|
|
if (ulError) { |
|
|
|
errno = S_objLib_OBJ_UNAVAILABLE; |
|
|
|
return (ERROR); |
|
|
|
|
|
|
|
} else { |
|
|
|
return ((int)ulMsg); |
|
|
|
} |
|
|
|