• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ InMainThread函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中InMainThread函数的典型用法代码示例。如果您正苦于以下问题:C++ InMainThread函数的具体用法?C++ InMainThread怎么用?C++ InMainThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了InMainThread函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: assert

void
DeviceDescriptor::Close()
{
  assert(InMainThread());
  assert(!IsBorrowed());

  CancelAsync();

#ifdef HAVE_INTERNAL_GPS
  delete internal_sensors;
  internal_sensors = nullptr;
#endif

#ifdef ANDROID
  delete droidsoar_v2;
  droidsoar_v2 = nullptr;

  for (unsigned i=0; i<sizeof i2cbaro/sizeof i2cbaro[0]; i++) {
    delete i2cbaro[i];
    i2cbaro[i] = nullptr;
  }
  delete nunchuck;
  nunchuck = nullptr;

  delete voltage;
  voltage = nullptr;

#endif

  /* safely delete the Device object */
  Device *old_device = device;

  {
    const ScopeLock protect(mutex);
    device = nullptr;
    /* after leaving this scope, no other thread may use the old
       object; to avoid locking the mutex for too long, the "delete"
       is called after the scope */
  }

  delete old_device;

  delete second_device;
  second_device = nullptr;

  Port *old_port = port;
  port = nullptr;
  delete old_port;

  ticker = false;

  {
    const ScopeLock lock(device_blackboard->mutex);
    device_blackboard->SetRealState(index).Reset();
    device_blackboard->ScheduleMerge();
  }

  settings_sent.Clear();
  settings_received.Clear();
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:60,代码来源:Descriptor.cpp


示例2: ApplyVegaSwitches

void
ApplyVegaSwitches()
{
  assert(InMainThread());

  const VegaSwitchState &switches = CommonInterface::Basic().switch_state.vega;

  // detect changes to ON: on now (x) and not on before (!lastx)
  // detect changes to OFF: off now (!x) and on before (lastx)

  const unsigned up_inputs = switches.inputs & ~last_vega_switches.inputs;
  const unsigned down_inputs = ~switches.inputs & last_vega_switches.inputs;
  const unsigned up_outputs = switches.outputs & ~last_vega_switches.outputs;
  const unsigned down_outputs = ~switches.outputs & last_vega_switches.outputs;
  last_vega_switches = switches;

  for (unsigned i = 0; i < 32; ++i) {
    const unsigned thebit = 1 << i;

    if (down_inputs & thebit)
      InputEvents::processNmea(i);
    else if (up_inputs & thebit)
      InputEvents::processNmea(i + 64);

    if (down_outputs & thebit)
      InputEvents::processNmea(i + 32);
    else if (up_outputs & thebit)
      InputEvents::processNmea(i + 96);
  }

}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:31,代码来源:ApplyVegaSwitches.cpp


示例3: assert

void
InputEvents::DoQueuedEvents()
{
  assert(InMainThread());

  int GCE_Queue_copy[MAX_GCE_QUEUE];
  int i;

  // copy the queue first, blocking
  {
    const ScopeLock lock(mutexEventQueue);
    std::copy_n(GCE_Queue, MAX_GCE_QUEUE, GCE_Queue_copy);
    std::fill_n(GCE_Queue, MAX_GCE_QUEUE, -1);
  }

  // process each item in the queue
  for (i = 0; i < MAX_GCE_QUEUE; i++) {
    if (GCE_Queue_copy[i] != -1) {
      processGlideComputer_real(GCE_Queue_copy[i]);
    }
  }
  for (i = 0; i < MAX_NMEA_QUEUE; i++) {
    if (NMEA_Queue[i] != -1)
      processNmea_real(NMEA_Queue[i]);
  }
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:26,代码来源:InputQueue.cpp


示例4: EnterDrawThread

void
EnterDrawThread()
{
  assert(InMainThread());
  assert(draw_thread_handle == zero_thread_handle);

  draw_thread_handle = ThreadHandle::GetCurrent();
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:8,代码来源:Components.cpp


示例5: LeaveDrawThread

void
LeaveDrawThread()
{
  assert(InMainThread());
  assert(draw_thread_handle.IsInside());

  draw_thread_handle = zero_thread_handle;
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:8,代码来源:Components.cpp


示例6: InDrawThread

bool
InDrawThread()
{
#ifdef ENABLE_OPENGL
  return InMainThread() && draw_thread_handle.IsInside();
#else
  return draw_thread != nullptr && draw_thread->IsInside();
#endif
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:9,代码来源:Components.cpp


示例7: assert

bool
DeviceDescriptor::PutStandbyFrequency(RadioFrequency frequency,
                                      OperationEnvironment &env)
{
  assert(InMainThread());

  if (device == NULL || !config.sync_to_device)
    return true;

  if (!Borrow())
    /* TODO: postpone until the borrowed device has been returned */
    return false;

  ScopeReturnDevice restore(*this, env);
  return device->PutStandbyFrequency(frequency, env);
}
开发者ID:Tjeerdm,项目名称:XCSoarDktjm,代码行数:16,代码来源:Descriptor.cpp


示例8: assert

void
DeviceDescriptor::OnNotification()
{
  /* notification from AsyncJobRunner, the Job was finished */

  assert(InMainThread());
  assert(open_job != nullptr);

  try {
    async.Wait();
  } catch (const std::runtime_error &e) {
    LogError(e);
  }

  delete open_job;
  open_job = nullptr;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:17,代码来源:Descriptor.cpp


示例9: assert

void
DeviceDescriptor::Open(OperationEnvironment &env)
{
  assert(InMainThread());
  assert(port == nullptr);
  assert(device == nullptr);
  assert(!ticker);
  assert(!IsBorrowed());

  if (is_simulator() || !config.IsAvailable())
    return;

  CancelAsync();

  assert(!IsOccupied());
  assert(open_job == nullptr);

  TCHAR buffer[64];
  LogFormat(_T("Opening device %s"), config.GetPortName(buffer, 64));

  open_job = new OpenDeviceJob(*this);
  async.Start(open_job, env, this);
}
开发者ID:M-Scholli,项目名称:XCSoar,代码行数:23,代码来源:Descriptor.cpp


示例10: GetComputerSettings

  /**
   * Returns the InterfaceBlackboard.ComputerSettings (read-only)
   * @return The InterfaceBlackboard.ComputerSettings
   */
  gcc_const
  static inline const ComputerSettings& GetComputerSettings() {
    assert(InMainThread());

    return Private::blackboard.GetComputerSettings();
  }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:10,代码来源:Interface.hpp


示例11: InDrawThread

bool
InDrawThread()
{
  return InMainThread();
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:5,代码来源:RunMapWindow.cpp


示例12: assert

  /**
   * Returns InterfaceBlackboard.Basic (NMEA_INFO) (read-only)
   * @return InterfaceBlackboard.Basic
   */
  gcc_const
  static inline const MoreData &Basic() {
    assert(InMainThread());

    return Private::blackboard.Basic();
  }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:10,代码来源:Interface.hpp


示例13: CanBorrow

  /**
   * Can this device be borrowed?
   *
   * May only be called from the main thread.
   *
   * @see Borrow()
   */
  bool CanBorrow() const {
    assert(InMainThread());

    return device != nullptr && GetState() == PortState::READY &&
      !IsOccupied();
  }
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:13,代码来源:Descriptor.hpp


示例14: IsOccupied

  /**
   * Is this device currently occupied, i.e. does somebody have
   * exclusive access?
   *
   * May only be called from the main thread.
   */
  bool IsOccupied() const {
    assert(InMainThread());

    return IsBorrowed() || async.IsBusy();
  }
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:11,代码来源:Descriptor.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ InOrder函数代码示例发布时间:2022-05-30
下一篇:
C++ InImageBridgeChildThread函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap