本文整理汇总了C++中CurOp::info方法的典型用法代码示例。如果您正苦于以下问题:C++ CurOp::info方法的具体用法?C++ CurOp::info怎么用?C++ CurOp::info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CurOp
的用法示例。
在下文中一共展示了CurOp::info方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
}
示例2: 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
}
}
示例3: getOp
CurOp* CurOp::getOp(const BSONObj& criteria) {
Matcher matcher(criteria);
Client& me = cc();
scoped_lock client_lock(Client::clientsMutex);
for (std::set<Client*>::iterator it = Client::clients.begin();
it != Client::clients.end();
it++) {
Client *client = *it;
verify(client);
CurOp* curop = client->curop();
if (client == &me || curop == NULL) {
continue;
}
BSONObj info = curop->info();
if (matcher.matches(info)) {
return curop;
}
}
return NULL;
}
示例4: inProgCmd
void inProgCmd( Message &m, DbResponse &dbresponse ) {
BSONObjBuilder b;
if (!cc().getAuthorizationManager()->checkAuthorization(
AuthorizationManager::SERVER_RESOURCE_NAME, ActionType::inprog)) {
b.append("err", "unauthorized");
}
else {
DbMessage d(m);
QueryMessage q(d);
bool all = q.query["$all"].trueValue();
bool allMatching = q.query["$allMatching"].trueValue();
vector<BSONObj> vals;
BSONObjBuilder qb;
for (BSONObjIterator it(q.query); it.more(); ) {
BSONElement e = it.next();
StringData fn(e.fieldName());
if (fn != "$all" && fn != "$allMatching") {
qb.append(e);
}
}
{
Client& me = cc();
scoped_lock bl(Client::clientsMutex);
scoped_ptr<Matcher> m(new Matcher(qb.done()));
for( set<Client*>::iterator i = Client::clients.begin(); i != Client::clients.end(); i++ ) {
Client *c = *i;
verify( c );
CurOp* co = c->curop();
if ( c == &me && !co ) {
continue;
}
verify( co );
if( all || allMatching || co->displayInCurop() ) {
BSONObj info = co->info();
if ( all || m->matches( info )) {
vals.push_back( info );
}
}
}
}
b.append("inprog", vals);
}
replyToQuery(0, m, dbresponse, b.obj());
}
示例5: 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
}
}
示例6: inProgCmd
void inProgCmd( Message &m, DbResponse &dbresponse ) {
BSONObjBuilder b;
if (!cc().getAuthorizationManager()->checkAuthorization(
AuthorizationManager::SERVER_RESOURCE_NAME, ActionType::inprog)) {
b.append("err", "unauthorized");
}
else {
DbMessage d(m);
QueryMessage q(d);
bool all = q.query["$all"].trueValue();
vector<BSONObj> vals;
{
Client& me = cc();
scoped_lock bl(Client::clientsMutex);
scoped_ptr<Matcher> m(new Matcher(q.query));
for( set<Client*>::iterator i = Client::clients.begin(); i != Client::clients.end(); i++ ) {
Client *c = *i;
verify( c );
CurOp* co = c->curop();
if ( c == &me && !co ) {
continue;
}
verify( co );
if( all || co->displayInCurop() ) {
BSONObj info = co->info();
if ( all || m->matches( info )) {
vals.push_back( info );
}
}
}
}
b.append("inprog", vals);
if( lockedForWriting() ) {
b.append("fsyncLock", true);
b.append("info", "use db.fsyncUnlock() to terminate the fsync write/snapshot lock");
}
}
replyToQuery(0, m, dbresponse, b.obj());
}
示例7: 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;
}
}
}