本文整理汇总了C++中ACE_Message_Block::locking_strategy方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Message_Block::locking_strategy方法的具体用法?C++ ACE_Message_Block::locking_strategy怎么用?C++ ACE_Message_Block::locking_strategy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Message_Block
的用法示例。
在下文中一共展示了ACE_Message_Block::locking_strategy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int
run_main (int, ACE_TCHAR *[])
{
ACE_START_TEST (ACE_TEXT ("Simple_Message_Block_Test"));
{
// Checks normal stack deletes.
ACE_Message_Block mb;
}
{
// Checks normal heap deletes.
ACE_Message_Block *mb = 0;
ACE_NEW_RETURN (mb, ACE_Message_Block, -1);
mb->release ();
}
{
// Checks continuation of message blocks on the stack.
ACE_Message_Block mb1 (1024);
ACE_Message_Block mb2 (1024);
mb1.cont (&mb2);
}
{
// Checks continuation of message blocks on the heap.
ACE_Message_Block *mb1;
ACE_Message_Block *mb2;
ACE_NEW_RETURN (mb1, ACE_Message_Block (1024), -1);
ACE_NEW_RETURN (mb2, ACE_Message_Block (1024), -1);
mb1->cont (mb2);
mb1->release ();
}
// Same set of tests but with locking_strategy set.
{
ACE_Lock_Adapter <ACE_SYNCH_MUTEX> mutex;
ACE_Lock *lock = &mutex;
{
// Checks normal stack deletes.
ACE_Message_Block mb;
mb.locking_strategy (lock);
}
{
// Checks normal heap deletes.
ACE_Message_Block *mb = 0;
ACE_NEW_RETURN (mb, ACE_Message_Block, -1);
mb->locking_strategy (lock);
mb->release ();
}
{
// Checks continuation of message blocks on the stack with one
// lock strategy.
ACE_Message_Block mb1 (1024);
ACE_Message_Block mb2 (1024);
mb1.locking_strategy (lock);
mb1.cont (&mb2);
}
{
// Checks continuation of message blocks on the heap with one
// lock strategy.
ACE_Message_Block *mb1;
ACE_Message_Block *mb2;
ACE_NEW_RETURN (mb1, ACE_Message_Block (1024), -1);
ACE_NEW_RETURN (mb2, ACE_Message_Block (1024), -1);
mb1->locking_strategy (lock);
mb1->cont (mb2);
mb1->release ();
}
{
// Checks continuation of message blocks on the stack with two
// lock strategy.
ACE_Message_Block mb1 (1024);
ACE_Message_Block mb2 (1024);
mb1.locking_strategy (lock);
mb2.locking_strategy (lock);
mb1.cont (&mb2);
}
{
// Checks continuation of message blocks on the heap with two
// lock strategy
ACE_Message_Block *mb1;
ACE_Message_Block *mb2;
//.........这里部分代码省略.........