peakzhang 发表于 2007-12-19 21:48:36

ACE程序员指南上的一段代码

p211

...
ACE_Message_Block mb;
for(int i=0; i<100; i++)
{
    hp_handler.putq(&mb);
    lp_handler.putq(&mb);
}
...

这样把同一个Message_Block多次多出插入队列会造成错误吧?
我运行书上这段代码时好像segment fault了。
向各位求证...

peakzhang 发表于 2007-12-19 21:48:48

It's ace_msg_queue bearer(or issue).It can't handle adding same msg_blk mulit-times.
I don't think they gonna fix it. what you can do is
hp_handler.putq(mb->duplicate());
then release it when you getq.
页: [1]
查看完整版本: ACE程序员指南上的一段代码