From 2b48c417c5b4f2fa78ab0960eb718ff081fa48e6 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 9 May 2022 13:03:01 +0200 Subject: Add new idevice_events_subscribe/unsubscribe API with context The older API idevice_event_subscribe/unsubscribe can only be used by a single instance. With the addition of a context, is is now possible to register multiple callback functions in different threads. For backwards compatibility the old API will still be available for a while before being removed in a future release. --- tools/idevicebtlogger.c | 5 +++-- tools/idevicesyslog.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/idevicebtlogger.c b/tools/idevicebtlogger.c index 421ce98..8de6b22 100644 --- a/tools/idevicebtlogger.c +++ b/tools/idevicebtlogger.c @@ -440,13 +440,14 @@ int main(int argc, char *argv[]) assert(0); return -2; } - idevice_event_subscribe(device_event_cb, NULL); + idevice_subscription_context_t context = NULL; + idevice_events_subscribe(&context, device_event_cb, NULL); while (!quit_flag) { sleep(1); } - idevice_event_unsubscribe(); + idevice_events_unsubscribe(context); stop_logging(); fclose(packetlogger_file); diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c index f85c7cc..3084b97 100644 --- a/tools/idevicesyslog.c +++ b/tools/idevicesyslog.c @@ -709,12 +709,13 @@ int main(int argc, char *argv[]) line_buffer_size = 1024; line = malloc(line_buffer_size); - idevice_event_subscribe(device_event_cb, NULL); + idevice_subscription_context_t context = NULL; + idevice_events_subscribe(&context, device_event_cb, NULL); while (!quit_flag) { sleep(1); } - idevice_event_unsubscribe(); + idevice_events_unsubscribe(context); stop_logging(); if (num_proc_filters > 0) { -- cgit v1.1-32-gdbae