当前位置: 首页>>代码示例>>C++>>正文


C++ Attachment::cancelExternalConnection方法代码示例

本文整理汇总了C++中Attachment::cancelExternalConnection方法的典型用法代码示例。如果您正苦于以下问题:C++ Attachment::cancelExternalConnection方法的具体用法?C++ Attachment::cancelExternalConnection怎么用?C++ Attachment::cancelExternalConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Attachment的用法示例。


在下文中一共展示了Attachment::cancelExternalConnection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: shutdown_locks

static bool shutdown_locks(thread_db* tdbb, SSHORT flag)
{
    /**************************************
     *
     *	s h u t d o w n _ l o c k s
     *
     **************************************
     *
     * Functional description
     *	Release all attachment and database
     *	locks if database is quiet.
     *
     **************************************/
    Database* dbb = tdbb->getDatabase();

    /* Mark database and all active attachments as shutdown. */

    dbb->dbb_ast_flags &= ~(DBB_shutdown | DBB_shutdown_single | DBB_shutdown_full);

    switch (flag & isc_dpb_shut_mode_mask)
    {
    case isc_dpb_shut_normal:
        break;
    case isc_dpb_shut_multi:
        dbb->dbb_ast_flags |= DBB_shutdown;
        break;
    case isc_dpb_shut_single:
        dbb->dbb_ast_flags |= DBB_shutdown | DBB_shutdown_single;
        break;
    case isc_dpb_shut_full:
        dbb->dbb_ast_flags |= DBB_shutdown | DBB_shutdown_full;
        break;
    default:
        fb_assert(false);
    }

    Attachment* attachment;

    for (attachment = dbb->dbb_attachments; attachment; attachment = attachment->att_next)
    {
        if (!(attachment->att_flags & ATT_shutdown_manager))
        {
            attachment->att_flags |= ATT_shutdown;
            attachment->cancelExternalConnection(tdbb);
            LCK_cancel_wait(attachment);
        }
    }

    JRD_shutdown_attachments(dbb);

    for (int retry = 0; retry < 10 && dbb->dbb_use_count; retry++)
    {
        // Let active database threads rundown
        Database::Checkout dcoHolder(dbb);
        THREAD_SLEEP(1 * 100);
    }

    if (dbb->dbb_use_count)
    {
        return false;
    }

    /* Since no attachment is actively running, release all
       attachment-specfic locks while they're not looking. */

    const Attachment* shut_attachment = NULL;

    for (attachment = dbb->dbb_attachments; attachment; attachment = attachment->att_next)
    {
        if (attachment->att_flags & ATT_shutdown_manager)
        {
            shut_attachment = attachment;
            continue;
        }

        if (attachment->att_id_lock)
            LCK_release(tdbb, attachment->att_id_lock);

        TRA_shutdown_attachment(tdbb, attachment);
    }

    /* Release database locks that are shared by all attachments.
       These include relation and index existence locks, as well
       as, relation interest and record locking locks for PC semantic
       record locking. */

    CMP_shutdown_database(tdbb);

    /* If shutdown manager is here, leave enough database lock context
       to run as a normal attachment. Otherwise, get rid of the rest
       of the database locks.*/

    if (!shut_attachment)
    {
        CCH_shutdown_database(dbb);
        if (dbb->dbb_monitor_lock)
            LCK_release(tdbb, dbb->dbb_monitor_lock);
        if (dbb->dbb_shadow_lock)
            LCK_release(tdbb, dbb->dbb_shadow_lock);
        if (dbb->dbb_retaining_lock)
//.........这里部分代码省略.........
开发者ID:secpersu,项目名称:dsploit,代码行数:101,代码来源:shut.cpp


注:本文中的Attachment::cancelExternalConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。