summaryrefslogtreecommitdiffstats
path: root/src/recovery.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/recovery.c')
-rw-r--r--src/recovery.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/recovery.c b/src/recovery.c
index 4a1e819..88eeab5 100644
--- a/src/recovery.c
+++ b/src/recovery.c
@@ -226,17 +226,21 @@ int recovery_enter_restore(struct idevicerestore_client_t* client, plist_t build
return -1;
}
+ mutex_lock(&client->device_event_mutex);
if (recovery_send_kernelcache(client, build_identity) < 0) {
+ mutex_unlock(&client->device_event_mutex);
error("ERROR: Unable to send KernelCache\n");
return -1;
}
debug("DEBUG: Waiting for device to disconnect...\n");
- WAIT_FOR(client->mode != &idevicerestore_modes[MODE_RECOVERY] || (client->flags & FLAG_QUIT), 30);
+ cond_wait_timeout(&client->device_event_cond, &client->device_event_mutex, 30000);
if (client->mode == &idevicerestore_modes[MODE_RECOVERY] || (client->flags & FLAG_QUIT)) {
+ mutex_unlock(&client->device_event_mutex);
error("ERROR: Failed to place device in restore mode\n");
return -1;
}
+ mutex_unlock(&client->device_event_mutex);
return 0;
}