当前位置: 首页>>代码示例>>C++>>正文


C++ Future::Get方法代码示例

本文整理汇总了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;
} 
开发者ID:good-mark,项目名称:lang_conceptions,代码行数:11,代码来源:main.cpp

示例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();
  }
}
开发者ID:peternewman,项目名称:ola,代码行数:19,代码来源:USBDeviceManager.cpp

示例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();
  }
}
开发者ID:DanielAeolusLaude,项目名称:ola,代码行数:24,代码来源:USBDeviceManager.cpp


注:本文中的Future::Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。