本文整理汇总了C++中ACE_Token_Proxy::renew方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Token_Proxy::renew方法的具体用法?C++ ACE_Token_Proxy::renew怎么用?C++ ACE_Token_Proxy::renew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Token_Proxy
的用法示例。
在下文中一共展示了ACE_Token_Proxy::renew方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
static void *
run_thread (void *vp)
{
ACE_Token_Proxy *collection = (ACE_Token_Proxy *) vp;
int count = iterations;
while (count--)
{
if (collection->acquire () == -1)
{
if (ACE_OS::last_error () == EDEADLK)
{
ACE_DEBUG ((LM_DEBUG, "deadlock detected in acquire"));
continue;
}
ACE_ERROR ((LM_ERROR, "(%t) %p acquire failed\n","run_thread"));
return (void *) -1;
}
ACE_DEBUG ((LM_DEBUG, "(%t) %s acquired.\n", collection->name ()));
if (collection->renew () == -1)
{
if (ACE_OS::last_error () == EDEADLK)
{
ACE_DEBUG ((LM_DEBUG, "deadlock detected"));
goto deadlock;
}
ACE_ERROR ((LM_ERROR, "(%t) %p renew failed\n","run_thread"));
return (void *) -1;
}
ACE_DEBUG ((LM_DEBUG, "(%t) %s renewed.\n", collection->name ()));
deadlock:
if (collection->release () == -1)
{
ACE_ERROR ((LM_ERROR, "(%t) %p release failed\n","run_thread"));
return (void *) -1;
}
ACE_DEBUG ((LM_DEBUG, "(%t) %s released.\n", collection->name ()));
}
ACE_DEBUG ((LM_DEBUG, "(%t) thread exiting.\n"));
return 0;
}
示例2: name
int
ACE_Token_Collection::renew (const ACE_TCHAR *token_name,
int requeue_position,
ACE_Synch_Options &options)
{
ACE_TRACE ("ACE_Token_Collection::renew");
TOKEN_NAME name (token_name);
ACE_Token_Proxy *temp;
// Get the token from the collection.
int result = collection_.find (name, temp);
// Did we find it?
if (result == -1)
ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT ("%p %s\n"),
ACE_TEXT ("not in collection "),
token_name), -1);
// perform the operation
return temp->renew (requeue_position, options);
}
示例3: switch
int
STDIN_Token::handle_input (ACE_HANDLE fd)
{
ACE_UNUSED_ARG (fd);
char tid[BUFSIZ];
char token[BUFSIZ];
char type[16];
char operation[16];
if (::scanf ("%s %s %s %s", tid, token, type, operation) <= 0)
{
ACE_OS::printf ("Try again.\n");
return 0;
}
ACE_Token_Proxy *proxy =
this->get_proxy (tid, token, type[0]);
if (proxy == 0)
return -1;
switch (operation[0])
{
case 'a':
case 'A':
if (proxy->acquire () == 0)
{
ACE_OS::printf ("Succeeded.\n");
if (ACE_TOKEN_INVARIANTS::instance ()->acquired (proxy) == 0)
ACE_OS::printf ("Violated invariant.\n");
}
else
ACE_ERROR ((LM_ERROR, "%p.\n", "Acquire failed"));
break;
case 'n':
case 'N':
ACE_TOKEN_INVARIANTS::instance ()->releasing (proxy);
if (proxy->renew () == 0)
{
ACE_OS::printf ("Succeeded.\n");
if (ACE_TOKEN_INVARIANTS::instance ()->acquired (proxy) == 0)
ACE_OS::printf ("Violated invariant.\n");
}
else
ACE_ERROR ((LM_ERROR, "%p.\n", "Renew failed"));
break;
case 'r':
case 'R':
ACE_TOKEN_INVARIANTS::instance ()->releasing (proxy);
if (proxy->release () == 0)
ACE_OS::printf ("Succeeded.\n");
else
ACE_ERROR ((LM_ERROR, "%p.\n", "Release failed"));
break;
case 't':
case 'T':
if (proxy->tryacquire () == 0)
{
ACE_OS::printf ("Succeeded.\n");
if (ACE_TOKEN_INVARIANTS::instance ()->acquired (proxy) == 0)
ACE_OS::printf ("Violated invariant.\n");
}
else
ACE_ERROR ((LM_ERROR, "%p.\n", "Tryacquire failed"));
break;
}
this->display_menu ();
return 0;
}