本文整理汇总了C++中CallbackHandle类的典型用法代码示例。如果您正苦于以下问题:C++ CallbackHandle类的具体用法?C++ CallbackHandle怎么用?C++ CallbackHandle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CallbackHandle类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ssl_ctx_callback
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;
}
示例2: debug_callback
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;
}
示例3: ssl_ctx_callback
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);
}
示例4: debug_callback
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;
}
示例5: unregisterCallback
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);
}
示例6: wait
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);
}
}
示例7: cancel
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);
}
}
}
示例8: header_callback
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));
}
示例9: seek_callback
static int seek_callback(void* userp, curl_off_t offset, int origin)
{
CallbackHandle* handle = (CallbackHandle*)userp;
return handle->seekCallback(handle->seekUserPointer, offset, origin);
}
示例10: header_callback
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));
}
示例11: wait
void ThreadPoolTaskExecutor::wait(const CallbackHandle& cbHandle) {
invariant(cbHandle.isValid());
auto cbState = checked_cast<CallbackState*>(getCallbackFromHandle(cbHandle));
waitForEvent(cbState->finishedEvent);
}