MCPcopy Create free account
hub / github.com/CMU-Perceptual-Computing-Lab/openpose / work

Method work

include/openpose/thread/subThreadQueueIn.hpp:50–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49 template<typename TDatums, typename TWorker, typename TQueue>
50 bool SubThreadQueueIn<TDatums, TWorker, TQueue>::work()
51 {
52 try
53 {
54 // Pop TDatums
55 if (spTQueueIn->empty())
56 std::this_thread::sleep_for(std::chrono::microseconds{100});
57 TDatums tDatums;
58 bool queueIsRunning = spTQueueIn->tryPop(tDatums);
59 // Check queue not empty
60 if (!queueIsRunning)
61 queueIsRunning = spTQueueIn->isRunning();
62 // Process TDatums
63 const auto workersAreRunning = this->workTWorkers(tDatums, queueIsRunning);
64 // Close queue input if all workers closed
65 if (!workersAreRunning)
66 spTQueueIn->stop();
67 return workersAreRunning;
68 }
69 catch (const std::exception& e)
70 {
71 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
72 spTQueueIn->stop();
73 return false;
74 }
75 }
76
77 COMPILE_TEMPLATE_DATUM(SubThreadQueueIn);
78}

Callers

nothing calls this directly

Calls 7

workTWorkersMethod · 0.80
whatMethod · 0.80
errorFunction · 0.50
emptyMethod · 0.45
tryPopMethod · 0.45
isRunningMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected