Skip to content

Commit

Permalink
[ci] Some more emscripten and macos build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Aug 10, 2023
1 parent b4966f5 commit 67feb3a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
21 changes: 15 additions & 6 deletions src/ossia-qt/js_utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,20 +552,29 @@ void apply_deferred_device_rec(
}
}

void device_creation_notify_recursively(ossia::net::device_base& device, auto& root_node)
{
for(auto& node : root_node.children())
{
device.on_node_created(*node);
if(auto p = node->get_parameter())
device.on_parameter_created(*p);

device_creation_notify_recursively(device, *node);
}
}

template <typename Device_T, typename Node_T, typename Data>
/** @ingroup JSTreeCreation **/
void apply_deferred_device(Device_T& device, deferred_js_node<Data>& root)
{
auto& nroot = static_cast<Node_T&>(device.get_root_node());
for(auto& cld : root.children)
{
apply_deferred_device_rec<Device_T, Node_T, Data>(
device, static_cast<Node_T&>(device.get_root_node()), cld);
apply_deferred_device_rec<Device_T, Node_T, Data>(device, nroot, cld);
}

for(auto& node : device.get_root_node().children())
{
device.on_node_created(*node);
}
device_creation_notify_recursively(device, nroot);
}

template <typename Methods>
Expand Down
1 change: 0 additions & 1 deletion src/ossia-qt/serial/serial_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ serial_protocol::serial_protocol(
= [this](ossia::net::parameter_base& p, const ossia::value& v) {
do_write(p, v);
};
qDebug() << "start timer in ms: " << (int)m_coalesce.value();

ossia::qt::run_async(m_threadWorker, [this] {
m_threadWorker->startTimer(m_coalesce.value(), Qt::PreciseTimer);
Expand Down
3 changes: 0 additions & 3 deletions src/ossia/audio/dummy_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ class dummy_engine final : public audio_engine
tick_end();
}
}};
#if defined(__linux__)
pthread_setname_np(m_runThread.native_handle(), "ossia execution");
#endif
}

~dummy_engine() override
Expand Down
12 changes: 5 additions & 7 deletions src/ossia/dataflow/execution/merged_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@ threaded_merged_execution_state_policy::threaded_merged_execution_state_policy()
ossia::launch(mm);
}
}
m_execWait.release();
}};
}

threaded_merged_execution_state_policy::~threaded_merged_execution_state_policy()
{
m_stopFlag.test_and_set(std::memory_order_release);
m_execWait.acquire();
m_valuesOutputThread.join();
}

Expand All @@ -78,8 +76,8 @@ inline void to_state_element(
void threaded_merged_execution_state_policy::commit()
{
// int i = 0;
m_calice.clear();
m_calice.reserve(10000);
m_states.clear();
m_states.reserve(10000);
for(auto it = m_valueState.begin(), end = m_valueState.end(); it != end; ++it)
{
auto& [param, vec] = *it;
Expand All @@ -88,7 +86,7 @@ void threaded_merged_execution_state_policy::commit()
case 0:
continue;
case 1: {
to_state_element(*param, vec[0].first, m_calice);
to_state_element(*param, vec[0].first, m_states);
//to_state_element(*param, vec[0].first).launch();
break;
}
Expand All @@ -101,14 +99,14 @@ void threaded_merged_execution_state_policy::commit()
vis(to_state_element(*param, std::move(val.first)));
}

m_calice.push_back(std::move(m_monoState.e));
m_states.push_back(std::move(m_monoState.e));
//ossia::launch(m_monoState.e);
break;
}
}
vec.clear();
}
this->m_messagesToApply.enqueue(std::move(m_calice));
this->m_messagesToApply.enqueue(std::move(m_states));
// std::cout << "NUM MESSAGES: " << i << std::endl;

commit_common();
Expand Down
3 changes: 1 addition & 2 deletions src/ossia/dataflow/execution/merged_policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ struct threaded_merged_execution_state_policy : local_state_execution_policy
m_messagesToApply;

std::atomic_flag m_stopFlag = ATOMIC_FLAG_INIT;
std::binary_semaphore m_execWait{0};

std::vector<ossia::state_element> m_calice;
std::vector<ossia::state_element> m_states;

int current_commit{};
};
Expand Down
6 changes: 4 additions & 2 deletions src/ossia/detail/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ void set_thread_name(std::thread& t, std::string_view name)
{
#if BOOST_OS_MACOS
pthread_setname_np(name.data());
#elif(BOOST_OS_UNIX || BOOST_OS_LINUX || BOOST_OS_BSD || BOOST_LIB_C_GNU)
#elif(BOOST_OS_UNIX || BOOST_OS_LINUX || BOOST_OS_BSD || BOOST_LIB_C_GNU) \
&& !defined(__EMSCRIPTEN__)
pthread_setname_np(t.native_handle(), name.data());
#endif
}
Expand All @@ -67,7 +68,8 @@ void set_thread_name(std::string_view name)
{
#if BOOST_OS_MACOS
pthread_setname_np(name.data());
#elif(BOOST_OS_UNIX || BOOST_OS_LINUX || BOOST_OS_BSD || BOOST_LIB_C_GNU)
#elif(BOOST_OS_UNIX || BOOST_OS_LINUX || BOOST_OS_BSD || BOOST_LIB_C_GNU) \
&& !defined(__EMSCRIPTEN__)
pthread_setname_np(pthread_self(), name.data());
#endif
}
Expand Down

0 comments on commit 67feb3a

Please sign in to comment.