OSSIA
Open Scenario System for Interactive Application
merged_policy.hpp
1 #pragma once
2 #include <ossia/dataflow/execution/execution_policy.hpp>
3 
4 #include <blockingconcurrentqueue.h>
5 
6 #include <semaphore>
7 
8 namespace ossia
9 {
10 struct
11 #if defined(OSSIA_TESTING)
12  OSSIA_EXPORT
13 #endif
14  merged_execution_state_policy : local_state_execution_policy
15 {
16  void commit() override;
17  ossia::mono_state m_monoState;
18 };
19 
20 struct threaded_merged_execution_state_policy : local_state_execution_policy
21 {
22  threaded_merged_execution_state_policy();
23  ~threaded_merged_execution_state_policy();
24 
25  void commit() override;
26  ossia::mono_state m_monoState;
27 
28  std::thread m_valuesOutputThread;
29 
30  // FIXME make sure that the sequencing is preserved so
31  // that we always get all the messages for commit N before all the messages for commit N+1
32  // FIXME in single thread mode we only need SPSC
33  moodycamel::BlockingConcurrentQueue<std::vector<ossia::state_element>>
34  m_messagesToApply;
35 
36  std::atomic_bool m_stopFlag{};
37 
38  std::vector<ossia::state_element> m_states;
39 
40  int current_commit{};
41 };
42 }
Definition: git_info.h:7