On Nov 7, 2016, at 10:00 AM, Sebastian Lackner <sebastian(a)fds-team.de> wrote:
On 04.11.2016 13:45, Aric Stewart wrote:
v2: remove Unload code as it will never be triggered v3: Suggestions from Ken Thomases Merge Implement adding IOHID devices into this patch
Signed-off-by: Aric Stewart <aric(a)codeweavers.com> --- dlls/winebus.sys/Makefile.in | 3 +- dlls/winebus.sys/bus.h | 1 + dlls/winebus.sys/bus_iohid.c | 255 +++++++++++++++++++++++++++++++++++++++++++ dlls/winebus.sys/main.c | 3 + 4 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 dlls/winebus.sys/bus_iohid.c
+ IOHIDManagerScheduleWithRunLoop(hid_manager, run_loop, kCFRunLoopDefaultMode); + if (IOHIDManagerOpen( hid_manager, 0 ) != kIOReturnSuccess) + { + ERR("Couldn't open IOHIDManager.\n"); + IOHIDManagerUnscheduleFromRunLoop(hid_manager, run_loop, kCFRunLoopDefaultMode); + CFRelease(hid_manager); + return 0; + } + + CFRunLoopRun(); + TRACE("Run Loop exiting\n"); + + IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, NULL, NULL); + IOHIDManagerUnscheduleFromRunLoop(hid_manager, run_loop, kCFRunLoopDefaultMode);
Can you be sure that run_loop is still valid here?
The run loop is still valid. It's a permanent property of the thread. Running a run loop is a transient thing you can do with it. It still exists after a given run is stopped. (It could be run again. Running a run loop can be nested. Etc.) -Ken