📄 quce.c
字号:
/* Indicate that the queue pointer is invalid. */
status = NU_INVALID_QUEUE;
else if (queue -> qu_id != QU_QUEUE_ID)
/* Indicate that the queue pointer is invalid. */
status = NU_INVALID_QUEUE;
else
/* All the parameters are okay, call the actual function to delete
a queue. */
status = QUC_Delete_Queue(queue_ptr);
/* Return completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* QUCE_Send_To_Queue */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the send message to queue function. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* QUC_Send_To_Queue Actual send queue message */
/* function */
/* TCCE_Suspend_Error Check suspend validity */
/* */
/* INPUTS */
/* */
/* queue_ptr Queue control block pointer */
/* message Pointer to message to send */
/* size Size of message to send */
/* suspend Suspension option if full */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_QUEUE Invalid queue pointer */
/* NU_INVALID_POINTER Invalid message pointer */
/* NU_INVALID_SIZE Invalid message size */
/* NU_INVALID_SUSPEND Invalid suspend request */
/* */
/* HISTORY */
/* */
/* DATE REMARKS */
/* */
/* 03-01-1993 Created initial version 1.0 */
/* 04-19-1993 Verified version 1.0 */
/* 03-01-1994 Modified function interface, */
/* resulting in version 1.1 */
/* */
/* 03-18-1994 Verified version 1.1 */
/* 06-04-1998 Corrected SPR493 */
/* */
/*************************************************************************/
STATUS QUCE_Send_To_Queue(NU_QUEUE *queue_ptr, VOID *message, UNSIGNED size,
UNSIGNED suspend)
{
QU_QCB *queue;
STATUS status;
/* Move input queue pointer into internal pointer. */
queue = (QU_QCB *) queue_ptr;
/* Determine if there is an error with the queue pointer. */
if (queue == NU_NULL)
/* Indicate that the queue pointer is invalid. */
status = NU_INVALID_QUEUE;
else if (queue -> qu_id != QU_QUEUE_ID)
/* Indicate that the queue pointer is invalid. */
status = NU_INVALID_QUEUE;
else if (message == NU_NULL)
/* Indicate that the pointer to the message is invalid. */
status = NU_INVALID_POINTER;
else if (size == 0)
/* Indicate that the message size is invalid. */
status = NU_INVALID_SIZE;
else if ((queue -> qu_fixed_size) && (size != queue -> qu_message_size))
/* Indicate that the message size is invalid. */
status = NU_INVALID_SIZE;
else if ((!queue -> qu_fixed_size) && (size > queue -> qu_message_size))
/* Indicate that the message size is invalid. */
status = NU_INVALID_SIZE;
else if ((suspend) && (TCCE_Suspend_Error()))
/* Indicate that the suspension is only allowed from a task thread. */
status = NU_INVALID_SUSPEND;
else
/* All the parameters are okay, call the actual function to send
a message to a queue. */
status = QUC_Send_To_Queue(queue_ptr, message, size, suspend);
/* Return completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* QUCE_Receive_From_Queue */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the receive message from queue function. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* QUC_Receive_From_Queue Actual receive message from */
/* queue */
/* TCCE_Suspend_Error Check suspend validity */
/* */
/* INPUTS */
/* */
/* queue_ptr Queue control block pointer */
/* message Pointer to message to send */
/* size Size of the message */
/* actual_size Size of message received */
/* suspend Suspension option if empty */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_QUEUE Invalid queue pointer */
/* NU_INVALID_POINTER Invalid message pointer */
/* NU_INVALID_SIZE Invalid message size */
/* NU_INVALID_SUSPEND Invalid suspend request */
/* */
/* HISTORY */
/* */
/* DATE REMARKS */
/* */
/* 03-01-1993 Created initial version 1.0 */
/* 04-19-1993 Verified version 1.0 */
/* 03-01-1994 Modified function interface, */
/* resulting in version 1.1 */
/* */
/* 03-18-1994 Verified version 1.1 */
/* 05-24-1996 Changed the variable queue check */
/* from "message size not equal */
/* to pipe message size" to */
/* "message size greater than */
/* pipe message size" (SPR142). */
/* */
/*************************************************************************/
STATUS QUCE_Receive_From_Queue(NU_QUEUE *queue_ptr, VOID *message,
UNSIGNED size, UNSIGNED *actual_size, UNSIGNED suspend)
{
QU_QCB *queue;
STATUS status;
/* Move input queue pointer into internal pointer. */
queue = (QU_QCB *) queue_ptr;
/* Determine if there is an error with the queue pointer. */
if (queue == NU_NULL)
/* Indicate that the queue pointer is invalid. */
status = NU_INVALID_QUEUE;
else if (queue -> qu_id != QU_QUEUE_ID)
/* Indicate that the queue pointer is invalid. */
status = NU_INVALID_QUEUE;
else if (message == NU_NULL)
/* Indicate that the pointer to the message is invalid. */
status = NU_INVALID_POINTER;
else if (size == 0)
/* Indicate that the message size is invalid. */
status = NU_INVALID_SIZE;
else if ((queue -> qu_fixed_size) && (size != queue -> qu_message_size))
/* Indicate that the message size is invalid. */
status = NU_INVALID_SIZE;
else if ((!queue -> qu_fixed_size) && (size > queue -> qu_message_size))
/* Indicate that the message size is invalid. */
status = NU_INVALID_SIZE;
else if ((suspend) && (TCCE_Suspend_Error()))
/* Indicate that the suspension is only allowed from a task thread. */
status = NU_INVALID_SUSPEND;
else
/* All the parameters are okay, call the actual function to receive
a message from a queue. */
status = QUC_Receive_From_Queue(queue_ptr, message, size,
actual_size, suspend);
/* Return completion status. */
return(status);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -