@@ -264,6 +264,7 @@ bool MxAccl::in_callback_func(vector<const MX::Types::FeatureMap *> dst, int cha
264264 }
265265 if (!send_queue.size ()) return false ;
266266 job = send_queue.front ();
267+ send_queue.pop_front ();
267268 }
268269
269270 SystemTimePoint starttime = std::chrono::system_clock::now ();
@@ -280,6 +281,10 @@ bool MxAccl::in_callback_func(vector<const MX::Types::FeatureMap *> dst, int cha
280281 } else {
281282 Debug (1 , " in_callback took: %.3f seconds" , FPSeconds (endtime - starttime).count ());
282283 }
284+ {
285+ std::lock_guard<std::mutex> lck (mutex_);
286+ receive_queue.push_back (job);
287+ }
283288 condition_.notify_one ();
284289 return true ;
285290}
@@ -290,12 +295,13 @@ bool MxAccl::out_callback_func(vector<const MX::Types::FeatureMap *> src, int ch
290295 Job *job;
291296 {
292297 std::unique_lock<std::mutex> lck (mutex_);
293- while (!send_queue .size () and !zm_terminate) {
294- Debug (1 , " MxAccl waiting, queue size %zu" , send_queue .size ());
298+ while (!receive_queue .size () and !zm_terminate) {
299+ Debug (1 , " MxAccl waiting, queue size %zu" , receive_queue .size ());
295300 condition_.wait (lck);
296301 }
297- if (!send_queue.size ()) return false ;
298- job = send_queue.front ();
302+ if (!receive_queue.size ()) return false ;
303+ job = receive_queue.front ();
304+ receive_queue.pop_front ();
299305 }
300306
301307 // Retrieve output data from accelerator
0 commit comments