void onConfirmedSet(const State& state) final { auto connStr = state.connStr; auto fun = [ serviceContext = _serviceContext, connStr ](auto args) { if (ErrorCodes::isCancelationError(args.status.code())) { return; } uassertStatusOK(args.status); LOG(0) << "Updating sharding state with confirmed set " << connStr; Grid::get(serviceContext)->shardRegistry()->updateReplSetHosts(connStr); if (MONGO_FAIL_POINT(failReplicaSetChangeConfigServerUpdateHook)) { return; } ShardRegistry::updateReplicaSetOnConfigServer(serviceContext, connStr); }; auto executor = Grid::get(_serviceContext)->getExecutorPool()->getFixedExecutor(); auto schedStatus = executor->scheduleWork(std::move(fun)).getStatus(); if (ErrorCodes::isCancelationError(schedStatus.code())) { LOG(2) << "Unable to schedule confirmed set update due to " << schedStatus; return; } uassertStatusOK(schedStatus); }
void JobManager::dispose (Disposable* obj) { uint8 buf [128]; forge.set_buffer (buf, 128); ObjectRef ref (forge, plugin.get_uris().jobs_Disposable, obj); scheduleWork (ref); }
bool ACPIBacklightPanel::doIntegerSet( OSDictionary * params, const OSSymbol * paramName, UInt32 value) { DbgLog("%s::%s(\"%s\", %d)\n", this->getName(), __FUNCTION__, paramName->getCStringNoCopy(), value); if ( gIODisplayBrightnessKey->isEqualTo(paramName)) { //DbgLog("%s::%s(%s) map %d -> %d\n", this->getName(),__FUNCTION__, paramName->getCStringNoCopy(), value, indexForLevel(value)); //REVIEW: workaround for Yosemite DP... if (value < 5 && _value > 5) { //REVIEW: copied from commit case below... // setting to zero automatically commits prior value UInt32 index = indexForLevel(_value); _committed_value = _value; // save to NVRAM in work loop scheduleWork(kWorkSave|kWorkSetBrightness); // save to BIOS nvram via ACPI if (hasSaveMethod) saveACPIBrightnessLevel(BCLlevels[index]); } if (0xFF == value) { setBrightnessLevelSmooth(_saved_value); return false; } //REVIEW: end workaround... setBrightnessLevelSmooth(value); if (value > 5) // more hacks for Yosemite (don't save really low values) _saved_value = value; return true; } else if (gIODisplayParametersCommitKey->isEqualTo(paramName)) { UInt32 index = indexForLevel(_value); //DbgLog("%s::%s(%s) map %d -> %d\n", this->getName(),__FUNCTION__, paramName->getCStringNoCopy(), value, index); _committed_value = _value; IODisplay::setParameter(params, gIODisplayBrightnessKey, _committed_value); // save to NVRAM in work loop scheduleWork(kWorkSave|kWorkSetBrightness); // save to BIOS nvram via ACPI if (hasSaveMethod) saveACPIBrightnessLevel(BCLlevels[index]); return true; } return false; }
IOReturn BrcmPatchRAM::onTimerEvent() { DebugLog("onTimerEvent\n"); if (!mDevice->getProperty(kFirmwareLoaded)) { AlwaysLog("BLURP!! no firmware loaded and timer expiried (no re-probe)\n"); scheduleWork(kWorkLoadFirmware); } return kIOReturnSuccess; }
void ReplicationCoordinatorExternalStateImpl::notifyOplogMetadataWaiters( const OpTime& committedOpTime) { signalOplogWaiters(); // Notify the DropPendingCollectionReaper if there are any drop-pending collections with drop // optimes before or at the committed optime. if (auto earliestDropOpTime = _dropPendingCollectionReaper->getEarliestDropOpTime()) { if (committedOpTime >= *earliestDropOpTime) { auto reaper = _dropPendingCollectionReaper; scheduleWork( _taskExecutor.get(), [committedOpTime, reaper](const executor::TaskExecutor::CallbackArgs& args) { auto opCtx = cc().makeOperationContext(); reaper->dropCollectionsOlderThan(opCtx.get(), committedOpTime); }); } } }
StatusWith<TaskExecutor::CallbackHandle> ThreadPoolTaskExecutor::scheduleWorkAt( Date_t when, const CallbackFn& work) { if (when <= now()) { return scheduleWork(work); } stdx::lock_guard<stdx::mutex> lk(_mutex); auto cbHandle = enqueueCallbackState_inlock(&_sleepersQueue, work, when); if (!cbHandle.isOK()) { return cbHandle; } _net->setAlarm(when, [this, when, cbHandle] { auto cbState = checked_cast<CallbackState*>(getCallbackFromHandle(cbHandle.getValue())); if (cbState->canceled.load()) { return; } invariant(now() >= when); stdx::lock_guard<stdx::mutex> lk(_mutex); scheduleIntoPool_inlock(&_sleepersQueue, cbState->iter); }); return cbHandle; }