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


C++ SelectServer::Execute方法代码示例

本文整理汇总了C++中SelectServer::Execute方法的典型用法代码示例。如果您正苦于以下问题:C++ SelectServer::Execute方法的具体用法?C++ SelectServer::Execute怎么用?C++ SelectServer::Execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SelectServer的用法示例。


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

示例1: testSameThreadCallback

/**
 * Check that a callback from the SelectServer thread executes.
 */
void SelectServerThreadTest::testSameThreadCallback() {
  TestThread test_thread(&m_ss, ola::thread::Thread::Self());
  m_ss.Execute(
      ola::NewSingleCallback(&test_thread, &TestThread::TestCallback));
  OLA_ASSERT_FALSE(test_thread.CallbackRun());
  m_ss.Run();
  OLA_ASSERT_TRUE(test_thread.CallbackRun());
}
开发者ID:DanielAeolusLaude,项目名称:ola,代码行数:11,代码来源:SelectServerThreadTest.cpp

示例2: DataReceived

/**
 * Called by the receive thread when new data arrives
 * @param device the device id which produced the data
 * @param data pointer to the data, ownership is transferred, use
 *   DeleteU8ArrayPtr to free.
 * @param data_length the size of the data
 */
void LogicReader::DataReceived(U64 device, U8 *data, uint32_t data_length) {
  {
    MutexLocker lock(&m_mu);
    if (device != m_device_id) {
      DevicesManagerInterface::DeleteU8ArrayPtr(data);
      return;
    }
  }
  m_ss->Execute(
      NewSingleCallback(this, &LogicReader::ProcessData, data, data_length));

  {
    MutexLocker lock(&m_data_mu);
    while (!m_free_data.empty()) {
      U8 *data = m_free_data.front();
      DevicesManagerInterface::DeleteU8ArrayPtr(data);
      m_free_data.pop();
    }
  }
}
开发者ID:Jazeido,项目名称:ola,代码行数:27,代码来源:logic-rdm-sniffer.cpp

示例3: testRemoveWriteWhenOtherReadable

/*
 * Check that RemoveWriteDescriptor is reentrant.
 * We use the Execute() method to close a write descriptor during the same
 * cycle in which it becomes writeable. See
 * https://github.com/OpenLightingProject/ola/pull/429 for details.
 */
void SelectServerTest::testRemoveWriteWhenOtherReadable() {
  Descriptors read_set, write_set, delete_set;
  LoopbackDescriptor *loopback = new LoopbackDescriptor();
  loopback->Init();
  loopback->SetOnWritable(NewCallback(this, &SelectServerTest::NullHandler));

  write_set.insert(loopback);
  delete_set.insert(loopback);

  OLA_ASSERT_TRUE(m_ss->AddWriteDescriptor(loopback));
  OLA_ASSERT_EQ(1, write_descriptor_count->Get());
  OLA_ASSERT_EQ(0, read_descriptor_count->Get());
  m_ss->Execute(NewSingleCallback(
      this, &SelectServerTest::RemoveAndDeleteDescriptors,
      read_set, write_set, delete_set));

  m_ss->Run();
  OLA_ASSERT_EQ(0, write_descriptor_count->Get());
  OLA_ASSERT_EQ(1, connected_read_descriptor_count->Get());
  OLA_ASSERT_EQ(0, read_descriptor_count->Get());
}
开发者ID:Jurrie,项目名称:ola,代码行数:27,代码来源:SelectServerTest.cpp


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