本文整理汇总了C++中Attachment::locksmith方法的典型用法代码示例。如果您正苦于以下问题:C++ Attachment::locksmith方法的具体用法?C++ Attachment::locksmith怎么用?C++ Attachment::locksmith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::locksmith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SHUT_database
void SHUT_database(thread_db* tdbb, SSHORT flag, SSHORT delay)
{
/**************************************
*
* S H U T _ d a t a b a s e
*
**************************************
*
* Functional description
* Schedule database for shutdown
*
**************************************/
SET_TDBB(tdbb);
Database* dbb = tdbb->getDatabase();
Attachment* attachment = tdbb->getAttachment();
/* Only platform's user locksmith can shutdown or bring online
a database. */
if (!attachment->locksmith())
{
ERR_post(Arg::Gds(isc_no_priv) << "shutdown" << "database" << dbb->dbb_filename);
}
const int shut_mode = flag & isc_dpb_shut_mode_mask;
// Check if requested shutdown mode is valid
// Note that if we are already in requested mode we just return true.
// This is required to ensure backward compatible behavior (gbak relies on that,
// user-written scripts may rely on this behaviour too)
switch (shut_mode)
{
case isc_dpb_shut_full:
if (dbb->dbb_ast_flags & DBB_shutdown_full)
{
same_mode();
return;
}
break;
case isc_dpb_shut_multi:
if ((dbb->dbb_ast_flags & DBB_shutdown_full) || (dbb->dbb_ast_flags & DBB_shutdown_single))
{
bad_mode();
}
if (dbb->dbb_ast_flags & DBB_shutdown)
{
same_mode();
return;
}
break;
case isc_dpb_shut_single:
if (dbb->dbb_ast_flags & DBB_shutdown_full)
{
bad_mode();
}
if (dbb->dbb_ast_flags & DBB_shutdown_single)
{
same_mode();
return;
}
break;
case isc_dpb_shut_normal:
if (!(dbb->dbb_ast_flags & DBB_shutdown))
{
same_mode();
return;
}
bad_mode();
default:
bad_mode(); // unexpected mode
}
// Reject exclusive and single-user shutdown attempts
// for a physically locked database
if (shut_mode == isc_dpb_shut_full || shut_mode == isc_dpb_shut_single)
{
check_backup_state(tdbb);
}
attachment->att_flags |= ATT_shutdown_manager;
--dbb->dbb_use_count;
/* Database is being shutdown. First notification gives shutdown
type and delay in seconds. */
bool exclusive = notify_shutdown(tdbb, flag, delay);
/* Notify local attachments */
SHUT_blocking_ast(tdbb);
/* Try to get exclusive database lock periodically up to specified delay. If we
haven't gotten it report shutdown error for weaker forms. For forced shutdown
keep notifying until successful. */
SSHORT timeout = delay - SHUT_WAIT_TIME;
if (!exclusive)
{
//.........这里部分代码省略.........