@@ -48,18 +48,20 @@ class iokit_hid_queue_value_monitor final : public dispatcher::extra::dispatcher
48
48
auto wait = make_thread_wait ();
49
49
50
50
run_loop_thread_->enqueue (^{
51
- if (hid_device_.get_device ()) {
52
- IOHIDDeviceRegisterRemovalCallback (*(hid_device_. get_device ()) ,
51
+ if (auto d = hid_device_.get_device ()) {
52
+ IOHIDDeviceRegisterRemovalCallback (*d ,
53
53
static_device_removal_callback,
54
54
this );
55
55
56
- IOHIDDeviceScheduleWithRunLoop (*(hid_device_. get_device ()) ,
56
+ IOHIDDeviceScheduleWithRunLoop (*d ,
57
57
run_loop_thread_->get_run_loop (),
58
58
kCFRunLoopCommonModes );
59
59
}
60
60
61
61
wait ->notify ();
62
62
});
63
+
64
+ wait ->wait_notice ();
63
65
}
64
66
65
67
virtual ~iokit_hid_queue_value_monitor (void ) {
@@ -78,17 +80,15 @@ class iokit_hid_queue_value_monitor final : public dispatcher::extra::dispatcher
78
80
run_loop_thread_->enqueue (^{
79
81
stop ({.check_requested_open_options = false });
80
82
81
- if (hid_device_.get_device ()) {
82
- IOHIDDeviceUnscheduleFromRunLoop (*(hid_device_. get_device ()) ,
83
+ if (auto d = hid_device_.get_device ()) {
84
+ IOHIDDeviceUnscheduleFromRunLoop (*d ,
83
85
run_loop_thread_->get_run_loop (),
84
86
kCFRunLoopCommonModes );
85
87
}
86
88
87
89
wait ->notify ();
88
90
});
89
91
90
- // Wait until all tasks are processed
91
-
92
92
wait ->wait_notice ();
93
93
}
94
94
0 commit comments