diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/msgqclean_8c_source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/msgqclean_8c_source.html Tue Mar 30 16:16:55 2010 +0100 @@ -0,0 +1,53 @@ + + +
+ +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 +