From a87359d3ffa281619e4f940c84898c10355702a1 Mon Sep 17 00:00:00 2001 From: Tim Sylvester Date: Wed, 20 Nov 2024 13:54:05 -0800 Subject: [PATCH] normalize syntax --- src/mbgl/tile/tile_cache.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mbgl/tile/tile_cache.cpp b/src/mbgl/tile/tile_cache.cpp index c0c534a2c75..9a05cefaaf4 100644 --- a/src/mbgl/tile/tile_cache.cpp +++ b/src/mbgl/tile/tile_cache.cpp @@ -13,10 +13,8 @@ TileCache::~TileCache() { clear(); pendingReleases.clear(); - std::unique_lock counterLock(deferredSignalLock); - while (deferredDeletionsPending != 0) { - deferredSignal.wait(counterLock); - } + std::unique_lock counterLock{deferredSignalLock}; + deferredSignal.wait(counterLock, [&]() { return deferredDeletionsPending == 0; }); } void TileCache::setSize(size_t size_) { @@ -94,6 +92,7 @@ void TileCache::deferPendingReleases() { deferredDeletionsPending--; deferredSignal.notify_all(); }}; + threadPool.schedule(std::move(func)); }