From 2c698304ca5dbe841495762c448f0a591eecb1c4 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Mon, 4 Jul 2022 18:08:45 -0700 Subject: [PATCH] [Playlist Loader] Revert background loader This reverts most of 802a86a3d83a411de8e76ba8ec7fbda74f3ee35e, since it didn't work anyway. Signed-off-by: Christopher Snowhill --- Playlist/PlaylistLoader.h | 3 --- Playlist/PlaylistLoader.m | 32 -------------------------------- 2 files changed, 35 deletions(-) diff --git a/Playlist/PlaylistLoader.h b/Playlist/PlaylistLoader.h index eb3b9b62a..88f6ebbb0 100644 --- a/Playlist/PlaylistLoader.h +++ b/Playlist/PlaylistLoader.h @@ -32,9 +32,6 @@ typedef enum { BOOL metadataLoadInProgress; NSMutableDictionary *queuedURLs; - - dispatch_queue_t loaderQueue; - atomic_int loaderQueueRefCount; } - (void)initDefaults; diff --git a/Playlist/PlaylistLoader.m b/Playlist/PlaylistLoader.m index c70df1ba8..4b34ce5eb 100644 --- a/Playlist/PlaylistLoader.m +++ b/Playlist/PlaylistLoader.m @@ -56,9 +56,6 @@ extern NSMutableDictionary *kArtworkDictionary; [queue setMaxConcurrentOperationCount:8]; queuedURLs = [[NSMutableDictionary alloc] init]; - - loaderQueue = dispatch_queue_create("Playlist loader queue", DISPATCH_QUEUE_SERIAL); - atomic_init(&loaderQueueRefCount, 0); } return self; @@ -335,35 +332,6 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc } - (NSArray *)insertURLs:(NSArray *)urls atIndex:(NSInteger)index sort:(BOOL)sort { - int refCount; - - do { - refCount = atomic_load_explicit(&loaderQueueRefCount, memory_order_relaxed); - if(refCount > 0) { - [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]]; - } - } while(refCount > 0); - - __block NSArray *outurls = nil; - - atomic_fetch_add(&self->loaderQueueRefCount, 1); - - dispatch_async(loaderQueue, ^{ - outurls = [self doInsertURLs:urls atIndex:index sort:sort]; - atomic_fetch_sub(&self->loaderQueueRefCount, 1); - }); - - do { - refCount = atomic_load_explicit(&loaderQueueRefCount, memory_order_relaxed); - if(refCount > 0) { - [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]]; - } - } while(refCount > 0); - - return outurls; -} - -- (NSArray *)doInsertURLs:(NSArray *)urls atIndex:(NSInteger)index sort:(BOOL)sort { NSMutableSet *uniqueURLs = [NSMutableSet set]; NSMutableArray *expandedURLs = [NSMutableArray array];