本文整理汇总了C++中ACE_Message_Block::msg_type方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Message_Block::msg_type方法的具体用法?C++ ACE_Message_Block::msg_type怎么用?C++ ACE_Message_Block::msg_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Message_Block
的用法示例。
在下文中一共展示了ACE_Message_Block::msg_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
int
Task::handle_input( ACE_HANDLE h )
{
const size_t size = 2000;
ACE_Message_Block * mb = new ACE_Message_Block( size );
ACE_Message_Block * pfrom = new ACE_Message_Block( sizeof( ACE_INET_Addr ) );
ACE_INET_Addr * addr = new ( pfrom->wr_ptr() ) ACE_INET_Addr();
int res = 0;
if ( mcast_handler_ && ( h == mcast_handler_->get_handle() ) ) {
mb->msg_type( constants::MB_MCAST );
res = mcast_handler_->recv( mb->wr_ptr(), size, *addr );
}
if ( res == (-1) ) {
DWORD err = GetLastError();
(void)err;
ACE_Message_Block::release( mb );
ACE_Message_Block::release( pfrom );
return 0;
}
mb->length( res );
mb->cont( pfrom );
putq( mb );
return 0;
}
示例2: svc
virtual int svc (void)
{
ACE_Thread_ID id;
thread_id_ = id;
while (1)
{
ACE_Message_Block *mb = 0;
if (this->getq (mb) == -1)
ACE_ERROR_BREAK
((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("getq")));
if (mb->msg_type () == ACE_Message_Block::MB_HANGUP)
{
ACE_DEBUG ((LM_INFO,
ACE_TEXT ("(%t) Shutting down\n")));
mb->release ();
break;
}
// Process the message.
process_message (mb);
// Return to work.
this->manager_->return_to_work (this);
}
return 0;
}
示例3: Exception
////////////////////////////////////////////////////////////////////////
// Now the svc() method where everything interesting happens.
//
int
LaserTask::svc()
{
MIRO_DBG_OSTR(SICK, LL_DEBUG, "("<<(void *) this <<"|"<<ACE_Thread::self ()<<") Task 0x%x starts in thread %u\n");
// Where we getq() the message
ACE_Message_Block *message;
LaserMessage * data;
while (true) {
// Get the message...
if (getq (message) == -1) {
throw Miro::Exception("LaserTask::svc: could not getq from message queue");
}
// Is it a shutdown request?
if (message->msg_type () == ACE_Message_Block::MB_HANGUP) {
break;
}
// Get the LaserMessage pointer out of the ACE message block.
data = (LaserMessage*)message->rd_ptr ();
if (!data)
throw Miro::Exception("LaserTask::svc: got empty message block");
doPkt( data );
// throw away message block
message->release ();
}
MIRO_LOG(LL_NOTICE, "left service.");
return (0);
}
示例4: while
int
Terminator::svc()
{
while (1)
{
ACE_Message_Block* mb = 0;
if (this->getq(mb) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t|%T) ERROR: Terminator::svc() could not get "
"message block from queue"), -1);
}
if (mb->msg_type () == ACE_Message_Block::MB_HANGUP)
{
mb->release ();
break;
}
int delay_secs = ACE_OS::atoi(mb->rd_ptr());
ACE_DEBUG ((LM_DEBUG,
"(%P|%t|%T) Terminator::svc() Sleeping %d seconds before aborting\n", delay_secs));
ACE_OS::sleep(delay_secs);
ACE_OS::abort();
}
return 0;
}
示例5: connect_to_serialport
void ZigbeeSerialportService::connect_to_serialport()
{
ACE_Message_Block *b = new ACE_Message_Block();
b->msg_type(ZIGBEE_SERIAL_PORT_CMD_CONNECT_PORT);
task_->message_queue.enqueue_tail(b);
}
示例6: put
static ACE_Message_Block * put( const T& t, unsigned long msg_type = 0 ) {
ACE_Message_Block * mb = new ACE_Message_Block( sizeof(T) );
*reinterpret_cast<T*>( mb->wr_ptr() ) = t;
mb->wr_ptr( sizeof(T) );
if ( msg_type >= ACE_Message_Block::MB_USER )
mb->msg_type( msg_type );
return mb;
}
示例7: exit_and_wait_thread
void ZigbeeSerialportService::exit_and_wait_thread()
{
ACE_Message_Block *b = new ACE_Message_Block();
b->msg_type(ZIGBEE_SERIAL_PORT_CMD_EXIT_THREAD);
task_->message_queue.enqueue_head(b);
task_->wait();
}
示例8:
void
tofSession_i::tof_debug( const CORBA::WChar * text, const CORBA::WChar * key )
{
ACE_OutputCDR cdr;
cdr.write_wstring( text );
cdr.write_wstring( key );
ACE_Message_Block * mb = cdr.begin()->duplicate();
mb->msg_type( constants::MB_DEBUG );
pTask_->putq( mb );
}
示例9:
void
Logging::commit_to_task()
{
// Broker::EventLog, that is not EventLog
if ( msg.get().format.in() && *msg.get().format.in() != 0 ) {
TAO_OutputCDR cdr;
cdr << msg.get();
ACE_Message_Block * mb = cdr.begin()->duplicate();
mb->msg_type( constants::MB_EVENTLOG );
iTask::instance()->putq( mb );
}
}
示例10: put
virtual int put (ACE_Message_Block *mblk, ACE_Time_Value *)
{
for (ACE_Message_Block *temp = mblk; temp != 0; temp = temp->cont ())
{
if (temp->msg_type () != ACE_Message_Block::MB_STOP)
{
format_data(temp);
}
}
return put_next (mblk);
}
示例11: commandFinished
void RASocket::commandFinished(void* callbackArg, bool /*success*/)
{
if (!callbackArg)
return;
RASocket* socket = static_cast<RASocket*>(callbackArg);
ACE_Message_Block* mb = new ACE_Message_Block();
mb->msg_type(ACE_Message_Block::MB_BREAK);
if (socket->putq(mb) == -1)
{
sLog.outRemote("Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno));
mb->release();
}
}
示例12: StopTask
void SiteWorkTask::StopTask()
{
if (_pSiteRenderTask)
{
_pSiteRenderTask->StopTask();
DEL_PTR(_pSiteRenderTask);
}
m_bStopped = true;
ACE_Message_Block *mb = new ACE_Message_Block();
mb->msg_type( ACE_Message_Block::MB_STOP );
this->putq( mb );
}
示例13: handle_input
int ZigbeeSerialportService::handle_input (ACE_HANDLE fd)
{
{
ACE_Message_Block *b = new ACE_Message_Block();
b->msg_type(ZIGBEE_SERIAL_PORT_CMD_GET_RES);
if (task_->message_queue.enqueue_tail(b)== -1 )
{
ACE_DEBUG((LM_DEBUG, "faild to input reactor block into queue\n"));
}
reactor()->suspend_handler(this);
}
return 0;
}
示例14: svc
int SiteWorkTask::svc()
{
ImageCommRequestArgs *pImageCommRequestArgs = NULL;
SetupDefaultComments();
while(true)
{
try
{
ACE_Message_Block *mb = NULL;
if( getq(mb) == -1 )
{
break;
}
if( mb->msg_type() == ACE_Message_Block::MB_STOP )
{
mb->release();
break;
}
if (NULL == mb)
{
continue;
}
memcpy(&pImageCommRequestArgs, mb->rd_ptr(), sizeof(pImageCommRequestArgs));
onCommandRequest(pImageCommRequestArgs);
delete pImageCommRequestArgs;
mb->release();
if (_pSiteRenderTask)
{
_pSiteRenderTask->Process();
}
}
catch(...)
{
//throw "work task crashed";
LOG_ERROR("catch exception.");
}
}
return 0;
}
示例15: svc
virtual int svc ()
{
int stop = 0;
for (ACE_Message_Block *mb; !stop && getq (mb) != -1; )
{
if (mb->msg_type () == ACE_Message_Block::MB_STOP)
{
stop = 1;
}
else
{
ACE_DEBUG ((LM_DEBUG, "%s",mb->base()));
}
put_next (mb);
}
return 0;
}