diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2020-08-12 16:06:38 -0700 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2020-08-12 16:06:38 -0700 |
commit | d67eb5beaa44c17c09f089a522ff483f4978a978 (patch) | |
tree | 8a5dffe3e6779dc95fa1adb32a1dc6d7be69c7af /libusb/os/windows_winusb.c | |
parent | ba6b8bcb7ea204e65a3deec3be81aacc9f4b6d5a (diff) | |
download | libusb-d67eb5beaa44c17c09f089a522ff483f4978a978.tar.gz |
core: Introduce platform events abstraction
The way in which system handles or resources are represented differs
greatly between Unix-like operating systems and Windows. Ever since
Windows support was added to libusb, Windows been emulating principles
of Unix-like operating systems such as file descriptors and poll().
This commit introduces an abstraction layer that completely removes the
need to perform any emulation. Fundamentally there are three things that
each platform provides to libusb:
1) A signallable event
2) A timer (not required, but useful)
3) A means to wait for event sources such as the above to be triggered
The POSIX abstraction for Unix-like operating systems uses file
descriptors as the "handles" to the underlying system resources. The
signallable event is implemented using a pipe, the timer as a timerfd
(where supported) and the poll() system call is used to wait for events.
The Windows abstraction uses native HANDLEs as the "handles" to the
underlying system resources. The signallable event is implemented using
a manual-reset event, the timer as a manual-reset waitable timer, and
the WaitForMultipleObjects() system call is used to wait for events.
Closes #252
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/os/windows_winusb.c')
-rw-r--r-- | libusb/os/windows_winusb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c index 04dda4a..fa6721e 100644 --- a/libusb/os/windows_winusb.c +++ b/libusb/os/windows_winusb.c @@ -467,7 +467,7 @@ static int get_interface_by_endpoint(struct libusb_config_descriptor *conf_desc, /* * Open a device and associate the HANDLE with the context's I/O completion port */ -HANDLE windows_open(struct libusb_device *dev, const char *path, DWORD access) +static HANDLE windows_open(struct libusb_device *dev, const char *path, DWORD access) { struct libusb_context *ctx = DEVICE_CTX(dev); struct windows_context_priv *priv = usbi_get_context_priv(ctx); |