MCPcopy Create free account
hub / github.com/e2wugui/zeze / uiThreadScheduleCount

Function uiThreadScheduleCount

cxx/utils.cpp:59–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 }
58
59 void uiThreadScheduleCount(size_t count)
60 {
61 std::vector<Runnable> tmp;
62 {
63 std::lock_guard<std::mutex> l(uithread::mutex);
64 if( uithread::tasks.size() <= count)
65 {
66 tmp.swap(uithread::tasks);
67 }
68 else
69 {
70 tmp.reserve(count);
71 auto b = uithread::tasks.begin();
72 auto e = b + count;
73 tmp.insert(tmp.begin(), b, e);
74 uithread::tasks.erase(b, e);
75 }
76 }
77 for (auto& task : tmp)
78 task();
79 }
80
81#pragma endregion
82#pragma region class Resource

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.65
swapMethod · 0.45
reserveMethod · 0.45
beginMethod · 0.45
insertMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected