Delete a message queue.
CS_RETCODE srv_deletemsgq(msgqnamep, msgqname_len,
msgqid)
CS_CHAR *msgqnamep; CS_INT msgqname_len; SRV_OBJID msgqid;
A pointer to the name of the message queue to delete. It is an error to attempt to delete a message queue that does not exist.
The length of the name pointed to by msgqname. If the name is null terminated, msgqname_len can be set to CS_NULLTERM.
A SRV_OBJID that specifies the identifier of message queue to delete.
Returns |
To indicate |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
#include <ospublic.h>
/*
** Local Prototype.
*/
CS_RETCODE ex_srv_deletemsgq PROTOTYPE((
CS_CHAR *msgqname,
CS_INT msgqname_len,
SRV_OBJID msgqid
));
/*
** EX_SRV_DELETEMSGQ
**
** Example routine using srv_deletemsgq to delete an Open
** Server message queue previously create by srv_createmsgq.
** This routine can be passed a value message queue name, or
** NULL,in which case the message queue identifier will be used.
**
** Arguments:
** msgqname The name of the message queue to delete. If
** NULL, the msgqid is used.
** msgqname_len The length of the name to which msgqname
** points.
** msgqid A SRV_OBJID that specifies the identifier of
** the message queue to delete.
**
** Returns:
**
** CS_SUCCEED The message queue was successfully deleted.
** CS_FAIL An error was detected.
*/
CS_RETCODE ex_srv_deletemsgq(msgqname, msgqname_len, msgqid)
CS_CHAR *msgqname;
CS_INT msgqname_len;
SRV_OBJID msgqid;
{
/*
** Delete a message queue.
*/
if (srv_deletemsgq(msgqname, msgqname_len, msgqid) !=
CS_SUCCEED)
{
return(CS_FAIL);
}
return(CS_SUCCEED);
}
Message queues can be deleted by either name or ID. If msgqname is not NULL, the message queue name is used; otherwise, the message queue ID is used.
Unread messages in the queue are flushed before the queue is deleted. Threads waiting in srv_putmsgq wake up. srv_putmsgq returns CS_FAIL.
When a message queue is deleted, threads waiting for messages from the queue wake up with a CS_FAIL return value from srv_getmsgq, and srv_getmsgq’s infop argument is set to SRV_I_DELETED.
The SRV_S_NUMMSGQUEUES server property determines the number of message queues available to an Open Server application. Refer to “Server properties”.
The SRV_S_MSGPOOL server property determines the number of messages available to an Open Server application at runtime. Refer to “Server properties”.