From c096fd02b4dfe8f29612e7ffea1143420f27c365 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 19 Jun 2019 11:04:15 -0700 Subject: [PATCH] [AltServer] Enforces one installation at a time Blocks dispatch queue until installation finishes, at which point the next installation can begin. --- AltServer/Devices/ALTDeviceManager.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AltServer/Devices/ALTDeviceManager.mm b/AltServer/Devices/ALTDeviceManager.mm index 287c922a..60a2d9ea 100644 --- a/AltServer/Devices/ALTDeviceManager.mm +++ b/AltServer/Devices/ALTDeviceManager.mm @@ -319,6 +319,8 @@ NSErrorDomain const ALTDeviceErrorDomain = @"com.rileytestut.ALTDeviceError"; client = NULL; } + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + NSProgress *installationProgress = [NSProgress progressWithTotalUnitCount:100 parent:progress pendingUnitCount:1]; self.installationProgress[UUID] = installationProgress; @@ -333,12 +335,16 @@ NSErrorDomain const ALTDeviceErrorDomain = @"com.rileytestut.ALTDeviceError"; NSLog(@"Error removing temporary directory. %@", error); } } + + dispatch_semaphore_signal(semaphore); }; NSLog(@"Installing to device %@...", udid); instproxy_install(ipc, destinationURL.relativePath.fileSystemRepresentation, options, ALTDeviceManagerUpdateStatus, uuidString); instproxy_client_options_free(options); + + dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); }); return progress;