Guest User

Untitled

a guest
Jun 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. void
  2. MultiThreadingPartition::Run (void)
  3. {
  4. pthread_mutex_lock (&m_partitionLock);
  5. m_stop = false;
  6. if (m_updateMaxTime)
  7. {
  8. Time maxTime = ComputeMaxTime ();
  9. m_maxTs = maxTime.GetHighPrecision ().GetInteger ();
  10. m_updateMaxTime = false;
  11. }
  12. while (!m_stop)
  13. {
  14. pthread_mutex_lock (&m_messagesLock);
  15. while (!m_messages.empty ())
  16. {
  17. Scheduler::Event ev = m_messages.front ();
  18. m_messages.pop ();
  19. NS_ASSERT (ev.key.m_ts >= m_currentTs);
  20. m_events->Insert (ev);
  21. }
  22. if (m_events->IsEmpty () || NextTs () >= m_maxTs)
  23. {
  24. pthread_mutex_unlock (&m_messagesLock);
  25. m_currentTs = m_maxTs - 1;
  26. //m_currentTs = m_maxTs;
  27. SendTimeUpdateMessages ();
  28. pthread_mutex_unlock (&m_partitionLock);
  29. return;
  30. }
  31. pthread_mutex_unlock (&m_messagesLock);
  32. while (!m_events->IsEmpty () && NextTs () < m_maxTs)
  33. {
  34. ProcessOneEvent ();
  35. }
  36. }
  37. pthread_mutex_unlock (&m_partitionLock);
  38. }
Add Comment
Please, Sign In to add comment