This repository has been archived by the owner on Mar 29, 2023. It is now read-only.
forked from hbldh/bleak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace NSRunLoop with dispatch queue
This replaces the NSRunLoop integration in the corebluetooth backend with a dispatch queue. This causes callbacks to be dispatched on a background thread instead of on the main dispatch queue on the main thread. `call_soon_threadsafe()` is used to synchronize the events with the event loop where the central manager was created. The NSRunLoop caused problems because it had to manually be called from the main thread. This left an asyncio task that had to be manually stopped at the end of a program to prevent errors about the still running task (issue: hbldh#111). The NSRunLoop implementation was also not very efficient since it was waking up the event loop every millisecond to check for events.
- Loading branch information
Showing
3 changed files
with
173 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters