00001 00010 #include <errno.h> 00011 #include <sys/msg.h> 00012 #include "MsgQInternal.h" 00013 00014 00015 /**************************************************************************** 00016 * MsgQClean (qName, err) 00017 * Description: Function that empties the specified queue 00018 *****************************************************************************/ 00019 00020 EXPORT_C int MsgQClean(ULONG qName, int* err) { 00021 MSGQ_INFO* pMsgQInfo = NULL; 00022 char msg[MAX_MSG_LEN]; 00023 int rcv_err; 00024 00025 if ((pMsgQInfo = MsgQTableLookup(qName)) != NULL) { 00026 // sending a message is not allowed 00027 pMsgQInfo->sendState = MSG_Q_CLEANING; 00028 // empty out the queue 00029 while(MsgQReceive(qName, msg, MAX_MSG_LEN, IPC_NOWAIT, &rcv_err) != ERROR) {}; 00030 if (rcv_err == ENOMSG) { 00031 *err = OK; 00032 return (OK); 00033 } 00034 else 00035 *err = rcv_err; 00036 // sending a message is allowed 00037 pMsgQInfo->sendState = MSG_Q_READY; 00038 } 00039 else 00040 *err = KMsgQLibQIdErr; 00041 00042 return(ERROR); 00043 } 00044 00045
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.