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

Method work

include/openpose/thread/subThreadQueueOut.hpp:50–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49 template<typename TDatums, typename TWorker, typename TQueue>
50 bool SubThreadQueueOut<TDatums, TWorker, TQueue>::work()
51 {
52 try
53 {
54 // If output queue is closed -> close input queue
55 if (!spTQueueOut->isRunning())
56 return false;
57 else
58 {
59 // Don't work until next queue is not full
60 // This reduces latency to half
61 if (!spTQueueOut->isFull())
62 {
63 // Process TDatums
64 TDatums tDatums;
65 const auto workersAreRunning = this->workTWorkers(tDatums, true);
66 // Push/emplace tDatums if successfully processed
67 if (workersAreRunning)
68 {
69 if (tDatums != nullptr)
70 spTQueueOut->waitAndEmplace(tDatums);
71 }
72 // Close queue otherwise
73 else
74 spTQueueOut->stopPusher();
75 return workersAreRunning;
76 }
77 else
78 {
79 std::this_thread::sleep_for(std::chrono::microseconds{100});
80 return true;
81 }
82 }
83 }
84 catch (const std::exception& e)
85 {
86 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
87 spTQueueOut->stop();
88 return false;
89 }
90 }
91
92 COMPILE_TEMPLATE_DATUM(SubThreadQueueOut);
93}

Callers

nothing calls this directly

Calls 8

isFullMethod · 0.80
workTWorkersMethod · 0.80
stopPusherMethod · 0.80
whatMethod · 0.80
errorFunction · 0.50
isRunningMethod · 0.45
waitAndEmplaceMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected