你好,的确是没有这个功能。但是有没有办法可以实现呢?因为消息队列内的内容比较庞大,我想设计一个进程专门清理内容的,比如达到一个阈值,把它清空。或者说,达到一个阈值,干脆删掉重建,但是关键是怎么获取这个内容的量来与阈值对比呢?我刚开始接触,望谅解[/quote]
用IPC_STAT可以获取到消息队列的数量:
int msgctl(int msqid, IPC_STAT, struct msqid_ds *buf);
struct msqid_ds {
...
unsigned long __msg_cbytes; /* Current number of bytes in
queue (nonstandard) */
msgqnum_t msg_qnum; /* Current number of messages
in queue */
msglen_t msg_qbytes; /* Maximum number of bytes
...
};