本文整理汇总了C++中MessageManager::postMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageManager::postMessage方法的具体用法?C++ MessageManager::postMessage怎么用?C++ MessageManager::postMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageManager
的用法示例。
在下文中一共展示了MessageManager::postMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: triggerShutdown
//
/// NAME
//
/// SHORT DESCRIPTION
//
/// Description:
/// LONG DESCRIPTION
///
/// Return
/// VALUE and DESCRIPTION
//
STATUS SystemManager::triggerShutdown(void)
{
SystemManagerMessage message;
MessageManager<SystemManagerMessage> messageManager;
// Post an activate message
message.major_type = SYSTEM_TRANSITION_TO_SHUTDOWN;
messageManager.postMessage(SystemManager::queue_id, message, QUEUE_TIMEOUT_INFINITE);
// Post an activate message
message.major_type = SYSTEM_SHUTDOWN;
messageManager.postMessage(SystemManager::queue_id, message, QUEUE_TIMEOUT_INFINITE);
return STATUS_SUCCESS;
}
示例2: systemLoop
//
/// NAME
//
/// SHORT DESCRIPTION
//
/// Description:
/// LONG DESCRIPTION
///
/// Return
/// VALUE and DESCRIPTION
//
STATUS SystemManager::systemLoop(void)
{
STATUS status = STATUS_FAILURE;
MessageManager<SystemManagerMessage> messageManager;
SystemManagerMessage message;
// Create a message queue
QueueManager::createQueue(SystemManager::queue_id, MAX_QUEUE_SIZE_DEFAULT);
// Post an activate message
message.major_type = SYSTEM_ACTIVATE;
messageManager.postMessage(SystemManager::queue_id, message, QUEUE_TIMEOUT_INFINITE);
// Start loop
while(1)
{
status = messageManager.getMessage(SystemManager::queue_id,
message,
QUEUE_TIMEOUT_DEFAULT);
if(status == STATUS_SUCCESS)
{
LogManager::logMessage(MODULE_SYSTEM_MANAGER,
DEBUG_LEVEL,
NULL,
"Received Message, Major Type: %lu",
message.major_type);
switch(mState)
{
case SYSTEM_MANAGER_INIT:
status = initProcessing(message);
break;
case SYSTEM_MANAGER_ACTIVE:
status = activeProcessing(message);
break;
case SYSTEM_MANAGER_SHUTDOWN:
status = shutdownProcessing(message);
break;
default:
break;
}
if(status == STATUS_SHUTDOWN_SUCCESS)
{
break;
}
}
}
mThreadGroup.join_all();
LogManager::logMessage(MODULE_SYSTEM_MANAGER,
DEBUG_LEVEL,
NULL,
"All Threads Joined Succesfully.");
return STATUS_SUCCESS;
}