
Hi Some message handle routine were skipped.. -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of vicente.botet Sent: Tuesday, September 08, 2009 2:07 PM To: boost@lists.boost.org Subject: Re: [boost] [interprocess]why message_queue receive() will consumesomuch CPU resource Hi, ----- Original Message ----- From: <jon_zhou@agilent.com> To: <boost@lists.boost.org>; <jon_zhou@agilent.com> Sent: Tuesday, September 08, 2009 4:20 AM Subject: [boost] [interprocess]why message_queue receive() will consume somuch CPU resource
Hi there
I just found that message_queue::receive() or message_queue:: timed_receive () consume high CPU resource, (99% CPU) the code like the below:
//create message_queue
date d(2009,Sep,8); //an arbitrary date //construct a time by adding up some durations durations ptime t1(d, hours(0)+minutes(0)+seconds(1)+millisec(0));
while (1) { for(int i = 0; i < 100; ++i){ int number; //mq.receive(&number, sizeof(number), recvd_size, priority); mq.timed_receive(&number, sizeof(number), recvd_size, priority,t1); } }
As I know, both the receive() & timed_receive() are block method, there should be sleep mechanism inside. why it still need so much CPU resource?
Just a question, What your code does other than calling mq.timed_receive()? Reagrds, Vicente _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost