本文整理汇总了C++中Future::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ Future::Get方法的具体用法?C++ Future::Get怎么用?C++ Future::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Future
的用法示例。
在下文中一共展示了Future::Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SecondThreadFunc
unsigned __stdcall SecondThreadFunc( void* pArguments )
{
printf( "In second thread...\n" );
Future<int>* f = ( Future<int>* ) pArguments;
std::cout << "In SecondThreadFunc " << f->Get() << std::endl;
while ( Counter < 100000 )
Counter++;
CloseHandle( GetCurrentThread() );
_endthreadex( 0 );
return 0;
}
示例2: SignalEvent
void USBDeviceManager::SignalEvent(EventType event, JaRuleWidget* widget) {
if (!m_notification_cb.get()) {
return;
}
if (pthread_equal(m_start_thread_id, Thread::Self())) {
// We're within Start(), so we can execute the callbacks directly.
m_notification_cb->Run(event, widget);
} else {
// We're not within Start(), which means we're running on the hotplug agent
// thread. Schedule the callback to run and wait for it to complete.
// By waiting we ensure the callback has completed before we go ahead and
// delete the widget.
Future<void> f;
m_ss->Execute(NewSingleCallback(this, &USBDeviceManager::WidgetEvent,
event, widget, &f));
f.Get();
}
}
示例3: SignalEvent
void USBDeviceManager::SignalEvent(EventType event,
JaRuleEndpoint* device,
MutexLocker* locker) {
// We hold the lock at this point.
if (!m_notification_cb.get()) {
return;
}
if (pthread_equal(m_start_thread_id, Thread::Self())) {
locker->Release();
// We're within Start(), so we can execute the callbacks directly.
m_notification_cb->Run(event, device);
} else {
// We're not within Start(), which means we're running on the libusb event
// thread. Schedule the callback to run and wait for it to complete.
// By waiting we ensure the callback has completed before we go ahead and
// delete the device.
Future<void> f;
m_ss->Execute(NewSingleCallback(this, &USBDeviceManager::DeviceEvent,
event, device, &f));
locker->Release();
f.Get();
}
}