Ich habe im Code von Skin flatPlus mehrere Stellen , wo Timer abgefragt werden. Beispiel:
Code
if (Config.MenuTimerShowCount) {
uint TimerCount {0}, TimerActiveCount {0};
LOCK_TIMERS_READ; // Creates local const cTimers *Timers
for (const cTimer *Timer = Timers->First(); Timer; Timer = Timers->Next(Timer)) {
++TimerCount;
if (Timer->HasFlags(tfActive))
++TimerActiveCount;
} // for
m_LastTimerCount = TimerCount;
m_LastTimerActiveCount = TimerActiveCount;
NewTitle = cString::sprintf("%s (%d/%d)", Title, TimerActiveCount, TimerCount);
} // Config.MenuTimerShowCount
Display More
Aber ein mal auch das:
Code
// Look for timers
auto recCounterFuture = std::async([&NumRec]() {
LOCK_TIMERS_READ; // Creates local const cTimers *Timers
for (const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti)) {
if (ti->HasFlags(tfRecording))
++NumRec;
}
});
recCounterFuture.get();
if (NumRec) {
Bracht man das async zeugs? Ich verstehe den Nutzen in dem Fall nicht.