MCPcopy Create free account
hub / github.com/KTStephano/StratusGFX / Dispatch

Method Dispatch

Source/Engine/StratusThread.cpp:57–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 }
56
57 void Thread::Dispatch() {
58 {
59 std::unique_lock<std::mutex> ul(mutex_);
60
61 // If we're still processing a previous dispatch, don't try to process another
62 if (processing_.load()) return;
63
64 // If nothing to process, return early
65 if (frontQueue_.size() == 0) return;
66
67 // Copy contents of front buffer to back buffer for processing
68 for (const auto & func : frontQueue_) backQueue_.push_back(func);
69 frontQueue_.clear();
70
71 // Signal ready for processing
72 processing_.store(true);
73 }
74
75 // If we don't own the context, use the current thread
76 if (!ownsExecutionContext_) {
77 SetCurrentThread(this);
78 ProcessNext_();
79 NullifyCurrentThread();
80 }
81 }
82
83 void Thread::DispatchAndSynchronize() {
84 Dispatch();

Callers 4

ThreadTest.cppFile · 0.80
UpdateMethod · 0.80
ShutdownMethod · 0.80
Dispatch_Method · 0.80

Calls 2

SetCurrentThreadFunction · 0.85
NullifyCurrentThreadFunction · 0.85

Tested by

no test coverage detected