Status CursorManager::eraseCursor(OperationContext* txn, CursorId id, bool shouldAudit) {
|
ClientCursor* cursor;
|
|
{
|
stdx::lock_guard<SimpleMutex> lk(_mutex);
|
...
|
cursor = it->second;
|
...
|
cursor->kill();
|
_deregisterCursor_inlock(cursor);
|
}
|
|
// If 'cursor' represents an aggregation cursor, then the destructor of the ClientCursor will
|
// eventually cause the destructor of the underlying PlanExecutor to be called. Since the
|
// underlying PlanExecutor is also registered on this CursorManager, we must destruct 'cursor'
|
// without holding '_mutex' so that it's possible to call CursorManager::deregisterCursor()
|
// without deadlocking ourselves.
|
delete cursor;
|
return Status::OK();
|
}
|