Posix消息队列的基本操作——获取消息属性

#include 
#include 
#include 
#include 

int main(int argc, char** argv)
{
    mqd_t   mqd;
    struct  mq_attr attr;

    if(argc != 2)
    {
        printf("usage: mqgetattr ");
    }
    mqd = mq_open(argv[1], O_RDONLY);
    
    mq_getattr(mqd, &attr);

    printf("max #msgs = %ld, max #bytes/msg = %ld, "
            "#currently on queue = % ld\n",
            attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);

    mq_close(mqd);

    exit(0);
}

你可能感兴趣的:(多线程技术)