2020#include " reactor.hh"
2121#include " time.hh"
2222#include " time_barrier.hh"
23+ #include < unistd.h>
2324
2425namespace reactor {
2526
@@ -138,6 +139,7 @@ public:
138139
139140 inline auto acquire_tag (const Tag& tag, std::unique_lock<std::mutex>& lock, std::condition_variable& cv,
140141 const std::function<bool (void )>& abort_waiting) -> bool override {
142+ reactor_assert (lock.owns_lock ());
141143 log_.debug () << " downstream tries to acquire tag " << tag;
142144
143145 if (this ->upstream_port () == nullptr ) {
@@ -164,7 +166,7 @@ public:
164166 }
165167
166168 // Wait until we receive a release_tag message from upstream
167- return logical_time_barrier_.acquire_tag (tag, lock, cv, abort_waiting);
169+ return logical_time_barrier_.acquire_tag (tag, lock, abort_waiting);
168170 }
169171
170172 void bind_upstream_port (Port<T>* port) override {
@@ -201,15 +203,15 @@ public:
201203 };
202204 }
203205
204- inline auto acquire_tag (const Tag& tag, std::unique_lock<std::mutex>& lock, std::condition_variable& cv,
206+ inline auto acquire_tag (const Tag& tag, std::unique_lock<std::mutex>& lock,
205207 const std::function<bool (void )>& abort_waiting) -> bool override {
206208 // Since this is a delayed connection, we can go back in time and need to
207209 // acquire the latest upstream tag that can create an event at the given
208210 // tag. We also need to consider that given a delay d and a tag g=(t, n),
209211 // for any value of n, g + d = (t, 0). Hence, we need to quire a tag with
210212 // the highest possible microstep value.
211213 auto upstream_tag = tag.subtract (this ->min_delay ());
212- return EnclaveConnection<T>::acquire_tag (upstream_tag, lock, cv, abort_waiting);
214+ return EnclaveConnection<T>::acquire_tag (upstream_tag, lock, abort_waiting);
213215 }
214216};
215217
@@ -230,10 +232,10 @@ public:
230232 };
231233 }
232234
233- inline auto acquire_tag (const Tag& tag, std::unique_lock<std::mutex>& lock, std::condition_variable& cv,
235+ inline auto acquire_tag (const Tag& tag, std::unique_lock<std::mutex>& lock,
234236 const std::function<bool (void )>& abort_waiting) -> bool override {
235237 this ->log_ .debug () << " downstream tries to acquire tag " << tag;
236- return PhysicalTimeBarrier::acquire_tag (tag, lock, cv , abort_waiting);
238+ return PhysicalTimeBarrier::acquire_tag (tag, lock, this -> environmet ()-> scheduler () , abort_waiting);
237239 }
238240
239241 void bind_upstream_port (Port<T>* port) override { Connection<T>::bind_upstream_port (port); }
0 commit comments