Skip to content
This repository was archived by the owner on May 3, 2026. It is now read-only.

Commit e2c2785

Browse files
liam-tealeion098
andauthored
simplify port_mutex_lock_all
Co-authored-by: ion098 <146852218+ion098@users.noreply.github.com>
1 parent b89fb52 commit e2c2785

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/system/system_daemon.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ static void unlock_ports(std::index_sequence<Is...>) {
5757
*
5858
*/
5959
static void port_mutex_lock_all() {
60-
// this looks weird because of how std::lock is implemented. See lock_ports for details.
61-
constexpr auto num_ports = std::tuple_size<decltype(zest::Brain::ports)>::value;
62-
lock_ports(std::make_index_sequence<num_ports>{});
60+
[]<size_t... Is>(std::index_sequence<Is...>) {
61+
std::lock(zest::Brain::ports[Is].mutex...);
62+
}(std::make_index_sequence<zest::Brain::ports.size()>{});
6363
}
6464

6565
/**

0 commit comments

Comments
 (0)