1 #ifndef OPENPOSE_THREAD_THREAD_QUEUE_IN_OUT_HPP
2 #define OPENPOSE_THREAD_THREAD_QUEUE_IN_OUT_HPP
11 template<
typename TDatums,
typename TWorker = std::shared_ptr<Worker<TDatums>>,
typename TQueue = Queue<TDatums>>
15 SubThreadQueueInOut(
const std::vector<TWorker>& tWorkers,
const std::shared_ptr<TQueue>& tQueueIn,
16 const std::shared_ptr<TQueue>& tQueueOut);
23 std::shared_ptr<TQueue> spTQueueIn;
24 std::shared_ptr<TQueue> spTQueueOut;
37 template<
typename TDatums,
typename TWorker,
typename TQueue>
39 const std::shared_ptr<TQueue>& tQueueIn,
40 const std::shared_ptr<TQueue>& tQueueOut) :
49 template<
typename TDatums,
typename TWorker,
typename TQueue>
54 template<
typename TDatums,
typename TWorker,
typename TQueue>
74 std::this_thread::sleep_for(std::chrono::microseconds{100});
76 bool workersAreRunning =
spTQueueIn->tryPop(tDatums);
78 if (!workersAreRunning)
81 workersAreRunning = this->workTWorkers(tDatums, workersAreRunning);
83 if (workersAreRunning)
85 if (tDatums !=
nullptr)
94 return workersAreRunning;
98 std::this_thread::sleep_for(std::chrono::microseconds{100});
103 catch (
const std::exception& e)
105 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
115 #endif // OPENPOSE_THREAD_THREAD_QUEUE_IN_OUT_HPP
virtual ~SubThreadQueueInOut()
Definition: subThread.hpp:10
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
SubThreadQueueInOut(const std::vector< TWorker > &tWorkers, const std::shared_ptr< TQueue > &tQueueIn, const std::shared_ptr< TQueue > &tQueueOut)
Definition: subThreadQueueInOut.hpp:38
spTQueueIn
Definition: subThreadQueueIn.hpp:39
spTQueueOut
Definition: subThreadQueueInOut.hpp:43
Definition: subThreadQueueInOut.hpp:12
COMPILE_TEMPLATE_DATUM(WPoseTriangulation)