[Ace-users] how to force svc() to wait for the std::queue to fill up?

Bob yesbkay at yahoo.com
Thu Oct 25 14:22:37 CDT 2007


I have a task class which inherits MyTask : public
ACE_Task<ACE_MT_SYNCH>. In my svc() I have a loop
like:

int MyTask::svc()
{
	ACE_OS::sleep(1);
	while( !myQueue.empty() )
	{
                    // do something
                    if( myQueue.size() == 0 )
	             break;
	}
	return 0;
}

I do a wait() in the destructor.

Things work fine if I sleep(), however if I do not the queue is not
filled up and svc exits.

Unfortunately I cannot use ACE_Message_Block() - I cannot serlialize
my object.

Is there any other way to get arround this problem without sleep()?

ACE newbie.
Bob



More information about the Ace-users mailing list