-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: Introduce atomic type and operations
An atomic variable is useful for reference counting and is much less overhead than accessing such a variable while holding a lock. To that end, replace the libusb_device 'refcnt' variable with an atomic and use the atomic operations to manipulate it. This removes the need for the mutex in the libusb_device. Also convert the 'attached' variable to an atomic as well. This variable was previously accessed both while holding the libusb_device mutex and not. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
- Loading branch information
Showing
4 changed files
with
76 additions
and
42 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
#define LIBUSB_NANO 11586 | ||
#define LIBUSB_NANO 11587 |
1a08aa8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, we should not be using the __atomics. They are not part of any standard. Instead we should be (thought we already were) requiring c11 for atomics.