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,
const std::shared_ptr<TQueue>& tQueueOut);
20 std::shared_ptr<TQueue> spTQueueIn;
21 std::shared_ptr<TQueue> spTQueueOut;
34 template<
typename TDatums,
typename TWorker,
typename TQueue>
36 const std::shared_ptr<TQueue>& tQueueOut) :
45 template<
typename TDatums,
typename TWorker,
typename TQueue>
65 std::this_thread::sleep_for(std::chrono::microseconds{100});
67 bool workersAreRunning =
spTQueueIn->tryPop(tDatums);
69 if (!workersAreRunning)
72 workersAreRunning = this->workTWorkers(tDatums, workersAreRunning);
74 if (workersAreRunning)
76 if (tDatums !=
nullptr)
85 return workersAreRunning;
89 std::this_thread::sleep_for(std::chrono::microseconds{100});
94 catch (
const std::exception& e)
96 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
106 #endif // OPENPOSE_THREAD_THREAD_QUEUE_IN_OUT_HPP
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:35
spTQueueIn
Definition: subThreadQueueIn.hpp:37
spTQueueOut
Definition: subThreadQueueInOut.hpp:39
Definition: subThreadQueueInOut.hpp:12
COMPILE_TEMPLATE_DATUM(WPoseTriangulation)