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


C++ CurOp::parent方法代码示例

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


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

示例1: killOperation

    bool GlobalEnvironmentMongoD::killOperation(AtomicUInt opId) {
        scoped_lock clientLock(Client::clientsMutex);
        bool found = false;

        // XXX clean up
        {
            for( set< Client* >::const_iterator j = Client::clients.begin();
                 !found && j != Client::clients.end();
                 ++j ) {

                for( CurOp *k = ( *j )->curop(); !found && k; k = k->parent() ) {
                    if ( k->opNum() != opId )
                        continue;

                    k->kill();
                    for( CurOp *l = ( *j )->curop(); l; l = l->parent() ) {
                        l->kill();
                    }

                    found = true;
                }
            }
        }
        if ( found ) {
            interruptJs( &opId );
        }
        return found;
    }
开发者ID:DesignByOnyx,项目名称:mongo,代码行数:28,代码来源:global_environment_d.cpp

示例2: _killImpl_inclientlock

    bool KillCurrentOp::_killImpl_inclientlock(AtomicUInt i, bool* pNotifyFlag /* = NULL */) {
        bool found = false;
        {
            for( set< Client* >::const_iterator j = Client::clients.begin();
                 !found && j != Client::clients.end();
                 ++j ) {

                for( CurOp *k = ( *j )->curop(); !found && k; k = k->parent() ) {
                    if ( k->opNum() != i )
                        continue;

                    k->kill(pNotifyFlag);
                    for( CurOp *l = ( *j )->curop(); l; l = l->parent() ) {
                        l->kill();
                    }

                    found = true;
                }
            }
        }
        if ( found ) {
            interruptJs( &i );
        }
        return found;
    }
开发者ID:Axv2,项目名称:mongo,代码行数:25,代码来源:kill_current_op.cpp

示例3: staticYield

    void ClientCursor::staticYield( int micros , const StringData& ns , Record * rec ) {
        killCurrentOp.checkForInterrupt( false );
        {
            auto_ptr<LockMongoFilesShared> lk;
            if ( rec ) {
                // need to lock this else rec->touch won't be safe file could disappear
                lk.reset( new LockMongoFilesShared() );
            }
            
            dbtempreleasecond unlock;
            if ( unlock.unlocked() ) {
                if ( micros == -1 )
                    micros = Client::recommendedYieldMicros();
                if ( micros > 0 )
                    sleepmicros( micros );
            }
            else {
                CurOp * c = cc().curop();
                while ( c->parent() )
                    c = c->parent();
                warning() << "ClientCursor::yield can't unlock b/c of recursive lock"
                          << " ns: " << ns 
                          << " top: " << c->info()
                          << endl;
            }

            if ( rec )
                rec->touch();

            lk.reset(0); // need to release this before dbtempreleasecond
        }
    }
开发者ID:jfensign,项目名称:mongo,代码行数:32,代码来源:clientcursor.cpp

示例4: staticYield

    void ClientCursor::staticYield(int micros, const StringData& ns, const Record* rec) {
        bool haveReadLock = Lock::isReadLocked();

        killCurrentOp.checkForInterrupt();
        {
            auto_ptr<LockMongoFilesShared> lk;
            if ( rec ) {
                // need to lock this else rec->touch won't be safe file could disappear
                lk.reset( new LockMongoFilesShared() );
            }

            dbtempreleasecond unlock;
            if ( unlock.unlocked() ) {
                if ( haveReadLock ) {
                    // This sleep helps reader threads yield to writer threads.
                    // Without this, the underlying reader/writer lock implementations
                    // are not sufficiently writer-greedy.
#ifdef _WIN32
                    SwitchToThread();
#else
                    if ( micros == 0 ) {
                        yieldOrSleepFor1Microsecond();
                    }
                    else {
                        sleepmicros(1);
                    }
#endif
                }
                else {
                    if ( micros == -1 ) {
                        sleepmicros(Client::recommendedYieldMicros());
                    }
                    else if ( micros == 0 ) {
                        yieldOrSleepFor1Microsecond();
                    }
                    else if ( micros > 0 ) {
                        sleepmicros( micros );
                    }
                }

            }
            else if ( Listener::getTimeTracker() == 0 ) {
                // we aren't running a server, so likely a repair, so don't complain
            }
            else {
                CurOp * c = cc().curop();
                while ( c->parent() )
                    c = c->parent();
                warning() << "ClientCursor::staticYield can't unlock b/c of recursive lock"
                          << " ns: " << ns 
                          << " top: " << c->info()
                          << endl;
            }

            if ( rec )
                rec->touch();

            lk.reset(0); // need to release this before dbtempreleasecond
        }
    }
开发者ID:EshaMaharishi,项目名称:pubsub,代码行数:60,代码来源:clientcursor.cpp

示例5: checkForInterruptNoAssert

    Status OperationContextImpl::checkForInterruptNoAssert() {
        if (getGlobalServiceContext()->getKillAllOperations()) {
            return Status(ErrorCodes::InterruptedAtShutdown, "interrupted at shutdown");
        }

        CurOp* curOp = CurOp::get(this);
        if (curOp->maxTimeHasExpired()) {
            markKilled();
            return Status(ErrorCodes::ExceededTimeLimit, "operation exceeded time limit");
        }

        MONGO_FAIL_POINT_BLOCK(checkForInterruptFail, scopedFailPoint) {
            if (opShouldFail(this, scopedFailPoint.getData())) {
                log() << "set pending kill on "
                      << (curOp->parent() ? "nested" : "top-level")
                      << " op " << getOpID() << ", for checkForInterruptFail";
                markKilled();
            }
        }

        if (isKillPending()) {
            return Status(ErrorCodes::Interrupted, "operation was interrupted");
        }

        return Status::OK();
    }
开发者ID:foursquare,项目名称:mongo,代码行数:26,代码来源:operation_context_impl.cpp

示例6: kill

 void KillCurrentOp::kill(AtomicUInt i) {
     bool found = false;
     {
         scoped_lock l( Client::clientsMutex );
         for( set< Client* >::const_iterator j = Client::clients.begin(); !found && j != Client::clients.end(); ++j ) {
             for( CurOp *k = ( *j )->curop(); !found && k; k = k->parent() ) {
                 if ( k->opNum() == i ) {
                     k->kill();
                     for( CurOp *l = ( *j )->curop(); l != k; l = l->parent() ) {
                         l->kill();
                     }
                     found = true;
                 }
             }
         }
     }
     if ( found ) {
         interruptJs( &i );
     }
 }
开发者ID:matulef,项目名称:mongo,代码行数:20,代码来源:client.cpp

示例7: _killOperationsAssociatedWithClientAndOpId_inlock

    bool GlobalEnvironmentMongoD::_killOperationsAssociatedWithClientAndOpId_inlock(
            Client* client, unsigned int opId) {
        for( CurOp *k = client->curop(); k; k = k->parent() ) {
            if ( k->opNum() != opId )
                continue;

            k->kill();
            for( CurOp *l = client->curop(); l; l = l->parent() ) {
                l->kill();
            }

            for (size_t i = 0; i < _killOpListeners.size(); i++) {
                try {
                    _killOpListeners[i]->interrupt(opId);
                }
                catch (...) {
                    std::terminate();
                }
            }
            return true;
        }
        return false;
    }
开发者ID:ramgtv,项目名称:mongo,代码行数:23,代码来源:global_environment_d.cpp

示例8: killOperation

    bool GlobalEnvironmentMongoD::killOperation(unsigned int opId) {
        boost::mutex::scoped_lock clientLock(Client::clientsMutex);
        bool found = false;

        // XXX clean up
        {
            for(ClientSet::const_iterator j = Client::clients.begin();
                 !found && j != Client::clients.end();
                 ++j ) {

                for( CurOp *k = ( *j )->curop(); !found && k; k = k->parent() ) {
                    if ( k->opNum() != opId )
                        continue;

                    k->kill();
                    for( CurOp *l = ( *j )->curop(); l; l = l->parent() ) {
                        l->kill();
                    }

                    found = true;
                }
            }
        }

        if (found) {
            for (size_t i = 0; i < _killOpListeners.size(); i++) {
                try {
                    _killOpListeners[i]->interrupt(opId);
                }
                catch (...) {
                    std::terminate();
                }
            }
        }
        return found;
    }
开发者ID:mdkhaled,项目名称:mongo,代码行数:36,代码来源:global_environment_d.cpp

示例9: staticYield

    void ClientCursor::staticYield( int micros , const StringData& ns , Record * rec ) {
        bool haveReadLock = Lock::isReadLocked();

        killCurrentOp.checkForInterrupt( false );
        {
            auto_ptr<LockMongoFilesShared> lk;
            if ( rec ) {
                // need to lock this else rec->touch won't be safe file could disappear
                lk.reset( new LockMongoFilesShared() );
            }
            
            dbtempreleasecond unlock;
            if ( unlock.unlocked() ) {
                if ( haveReadLock ) {
                    // don't sleep with a read lock
                }
                else {
                    if ( micros == -1 )
                        micros = Client::recommendedYieldMicros();
                    if ( micros > 0 )
                        sleepmicros( micros );
                }
                
            }
            else if ( Listener::getTimeTracker() == 0 ) {
                // we aren't running a server, so likely a repair, so don't complain
            }
            else {
                CurOp * c = cc().curop();
                while ( c->parent() )
                    c = c->parent();
                warning() << "ClientCursor::yield can't unlock b/c of recursive lock"
                          << " ns: " << ns 
                          << " top: " << c->info()
                          << endl;
            }

            if ( rec )
                rec->touch();

            lk.reset(0); // need to release this before dbtempreleasecond
        }
    }
开发者ID:89snake89,项目名称:mongo,代码行数:43,代码来源:clientcursor.cpp

示例10: staticYield

 void ClientCursor::staticYield( int micros , const StringData& ns ) {
     killCurrentOp.checkForInterrupt( false );
     {
         dbtempreleasecond unlock;
         if ( unlock.unlocked() ) {
             if ( micros == -1 )
                 micros = Client::recommendedYieldMicros();
             if ( micros > 0 )
                 sleepmicros( micros );
         }
         else {
             CurOp * c = cc().curop();
             while ( c->parent() )
                 c = c->parent();
             warning() << "ClientCursor::yield can't unlock b/c of recursive lock"
                       << " ns: " << ns 
                       << " top: " << c->info()
                       << endl;
         }
     }
 }
开发者ID:Kenterfie,项目名称:mongo,代码行数:21,代码来源:clientcursor.cpp


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