diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/msgqcheck_8c_source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/msgqcheck_8c_source.html Tue Mar 30 16:16:55 2010 +0100 @@ -0,0 +1,54 @@ + + +
+ +00001 +00010 #include <errno.h> +00011 #include <sys/msg.h> +00012 #include "MsgQInternal.h" +00013 +00014 +00015 +00016 /***************************************************************************** +00017 * MsgQCheck +00018 * Function: Function for checking how many messages are in a queue +00019 *******************************************************************************/ +00020 +00021 EXPORT_C int MsgQCheck(ULONG qName, int* err) { +00022 MSGQ_INFO* pMsgQInfo = NULL; +00023 int nMsgs; +00024 struct msqid_ds qStatus ; +00025 +00026 if ((pMsgQInfo = MsgQTableLookup(qName)) != NULL) { +00027 // get total count of msgs from the msg queue +00028 if ((msgctl(pMsgQInfo->qId,IPC_STAT ,&qStatus)) >= 0 ) { +00029 nMsgs=qStatus.msg_qnum ; +00030 if (nMsgs == pMsgQInfo->numMsgs) { +00031 *err = OK; +00032 return(nMsgs); +00033 } +00034 else { +00035 *err = KMsgQLibQShortErr; +00036 return(pMsgQInfo->numMsgs); +00037 } +00038 } +00039 else +00040 *err=errno; +00041 } +00042 else +00043 *err = KMsgQLibQIdErr; +00044 return(ERROR); +00045 } +00046 +