File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -27,11 +27,16 @@ class dummy_engine final : public audio_engine
2727 void setup_thread ()
2828 {
2929 m_active = true ;
30-
3130 int us_per_buffer
3231 = 1e6 * double (effective_buffer_size) / double (effective_sample_rate);
3332
34- m_runThread = std::thread{[this , us_per_buffer] {
33+ auto started = std::make_shared<std::atomic_bool>(false );
34+ m_runThread = std::thread{[this , started, us_per_buffer] {
35+ while (!*started)
36+ {
37+ std::this_thread::yield ();
38+ }
39+ std::atomic_thread_fence (std::memory_order_seq_cst);
3540 ossia::set_thread_name (" ossia audio 0" );
3641 ossia::set_thread_pinned (thread_type::Audio, 0 );
3742 ossia::set_thread_realtime (m_runThread, 99 );
@@ -95,6 +100,10 @@ class dummy_engine final : public audio_engine
95100 tick_end ();
96101 }
97102 }};
103+
104+ std::atomic_thread_fence (std::memory_order_seq_cst);
105+
106+ *started = true ;
98107 }
99108
100109 void stop () override
You can’t perform that action at this time.
0 commit comments