static CURLcode ssl_ctx_callback(CURL* curl, void* sslCtx, void* userPointer) { CallbackHandle* handle = (CallbackHandle*)userPointer; int32_t result = handle->sslCtxCallback(curl, sslCtx, handle->sslUserPointer); return (CURLcode)result; }
static int debug_callback(CURL* curl, curl_infotype type, char* data, size_t size, void* userPointer) { assert(userPointer != NULL); CallbackHandle* handle = (CallbackHandle*)userPointer; handle->debugCallback(curl, (PAL_CurlInfoType)type, data, size, handle->debugUserPointer); return 0; }
static CURLcode ssl_ctx_callback(CURL* curl, void* sslCtx, void* userPointer) { CallbackHandle* handle = static_cast<CallbackHandle*>(userPointer); int32_t result = handle->sslCtxCallback(curl, sslCtx, handle->sslUserPointer); return static_cast<CURLcode>(result); }
static int debug_callback(CURL* curl, curl_infotype type, char* data, size_t size, void* userPointer) { assert(userPointer != nullptr); CallbackHandle* handle = static_cast<CallbackHandle*>(userPointer); handle->debugCallback(curl, static_cast<PAL_CurlInfoType>(type), data, size, handle->debugUserPointer); return 0; }
bool GraphObject::unregisterCallback(const CallbackHandle& handle) { if (!handle) return false; auto attribute = _attribFunctions.find(handle.getAttribute()); if (attribute == _attribFunctions.end()) return false; return attribute->second.unregisterCallback(handle); }
void ThreadPoolTaskExecutor::wait(const CallbackHandle& cbHandle) { invariant(cbHandle.isValid()); auto cbState = checked_cast<CallbackState*>(getCallbackFromHandle(cbHandle)); if (cbState->isFinished.load()) { return; } stdx::unique_lock<stdx::mutex> lk(_mutex); if (!cbState->finishedCondition) { cbState->finishedCondition.emplace(); } while (!cbState->isFinished.load()) { cbState->finishedCondition->wait(lk); } }
void ThreadPoolTaskExecutor::cancel(const CallbackHandle& cbHandle) { invariant(cbHandle.isValid()); auto cbState = checked_cast<CallbackState*>(getCallbackFromHandle(cbHandle)); stdx::unique_lock<stdx::mutex> lk(_mutex); cbState->canceled.store(1); if (cbState->isNetworkOperation) { lk.unlock(); _net->cancelCommand(cbHandle); return; } if (cbState->readyDate != Date_t{}) { // This callback might still be in the sleeper queue; if it is, schedule it now // rather than when the alarm fires. auto iter = std::find_if(_sleepersQueue.begin(), _sleepersQueue.end(), [cbState](const std::shared_ptr<CallbackState>& other) { return cbState == other.get(); }); if (iter != _sleepersQueue.end()) { invariant(iter == cbState->iter); scheduleIntoPool_inlock(&_sleepersQueue, cbState->iter); } } }
static size_t header_callback(char* buffer, size_t size, size_t nitems, void* instream) { CallbackHandle* handle = (CallbackHandle*)instream; return (size_t)(handle->headerCallback((uint8_t*)buffer, size, nitems, handle->headerUserPointer)); }
static int seek_callback(void* userp, curl_off_t offset, int origin) { CallbackHandle* handle = (CallbackHandle*)userp; return handle->seekCallback(handle->seekUserPointer, offset, origin); }
static size_t header_callback(char* buffer, size_t size, size_t nitems, void* instream) { CallbackHandle* handle = static_cast<CallbackHandle*>(instream); return static_cast<size_t>( handle->headerCallback(reinterpret_cast<uint8_t*>(buffer), size, nitems, handle->headerUserPointer)); }
void ThreadPoolTaskExecutor::wait(const CallbackHandle& cbHandle) { invariant(cbHandle.isValid()); auto cbState = checked_cast<CallbackState*>(getCallbackFromHandle(cbHandle)); waitForEvent(cbState->finishedEvent); }