asyncResourceGatherer: trace logs and exit behaviour (#414)

* asyncResourceGatherer: add trace logs

useful for debugging label updates

* label: remove unused onAssetCallbackTimer

* asyncResourceGatherer: fix crashes on exit
This commit is contained in:
Maximilian Seidler 2024-07-10 12:05:18 +02:00 committed by GitHub
parent 944caff79f
commit e5f0b56d07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 9 deletions

View File

@ -385,6 +385,8 @@ void CAsyncResourceGatherer::asyncAssetSpinLock() {
// process requests
for (auto& r : requests) {
Debug::log(TRACE, "Processing requested resourceID {}", r.id);
if (r.type == TARGET_TEXT) {
renderText(r);
} else if (r.type == TARGET_IMAGE) {
@ -399,11 +401,11 @@ void CAsyncResourceGatherer::asyncAssetSpinLock() {
g_pHyprlock->addTimer(std::chrono::milliseconds(0), timerCallback, new STimerCallbackData{r.callback, r.callbackData});
}
}
dmas.clear();
}
void CAsyncResourceGatherer::requestAsyncAssetPreload(const SPreloadRequest& request) {
Debug::log(TRACE, "Requesting label resource {}", request.id);
std::lock_guard<std::mutex> lg(asyncLoopState.requestsMutex);
asyncLoopState.requests.push_back(request);
asyncLoopState.pending = true;
@ -416,13 +418,14 @@ void CAsyncResourceGatherer::unloadAsset(SPreloadedAsset* asset) {
void CAsyncResourceGatherer::notify() {
std::lock_guard<std::mutex> lg(asyncLoopState.requestsMutex);
asyncLoopState.requests.clear();
asyncLoopState.pending = true;
asyncLoopState.requestsCV.notify_all();
}
void CAsyncResourceGatherer::await() {
if (asyncLoopThread.joinable())
asyncLoopThread.join();
if (initialGatherThread.joinable())
initialGatherThread.join();
if (asyncLoopThread.joinable())
asyncLoopThread.join();
}

View File

@ -147,11 +147,6 @@ bool CLabel::draw(const SRenderData& data) {
return false;
}
static void onAssetCallbackTimer(std::shared_ptr<CTimer> self, void* data) {
const auto PLABEL = (CLabel*)data;
PLABEL->renderSuper();
}
void CLabel::renderSuper() {
g_pHyprlock->renderOutput(outputStringPort);
}