This repository was archived by the owner on May 3, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,32 +25,6 @@ void vexTasksRun();
2525void ser_output_flush ();
2626}
2727
28- /* *
29- * @brief lock a sequence of smart ports
30- *
31- * For whatever reason, std::lock only compiles if you pass the mutexes like this:
32- * std::lock(mutex_a, mutex_b, mutex_c);
33- * You can't pass it an array or iterator or lambda, so we have to use this helper function instead.
34- */
35- template <std::size_t ... Is>
36- static void lock_ports (std::index_sequence<Is...>) {
37- // std::lock locks multiple mutexes without risk of a deadlock
38- std::lock (zest::Brain::ports[Is].mutex ...);
39- }
40-
41- /* *
42- * @brief unlock a sequence of smart ports
43- *
44- * For whatever reason, std::unlock only compiles if you pass the mutexes like this:
45- * std::unlock(mutex_a, mutex_b, mutex_c);
46- * You can't pass it an array or iterator or lambda, so we have to use this helper function instead
47- */
48- template <std::size_t ... Is>
49- static void unlock_ports (std::index_sequence<Is...>) {
50- constexpr std::size_t N = sizeof ...(Is);
51- // Unlock in reverse order (RAII best practice)
52- (zest::Brain::ports[N - 1 - Is].mutex .unlock (), ...);
53- }
5428
5529/* *
5630 * @brief lock all smart port mutexes
You can’t perform that action at this time.
0 commit comments