$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [interprocess]why message_queue receive() will consumesomuch CPU resource
From: jon_zhou_at_[hidden]
Date: 2009-09-08 03:00:40
Hi
Some message handle routine were skipped..
-----Original Message-----
From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of vicente.botet
Sent: Tuesday, September 08, 2009 2:07 PM
To: boost_at_[hidden]
Subject: Re: [boost] [interprocess]why message_queue receive() will consumesomuch CPU resource
Hi,
----- Original Message ----- 
From: <jon_zhou_at_[hidden]>
To: <boost_at_[hidden]>; <jon_zhou_at_[hidden]>
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://listarchives.boost.org/mailman/listinfo.cgi/boost