Chris Dickens
2017-07-05 18:48:52 UTC
Hi,
I have finally been able to get back to working on the event abstraction
effort. In the initial patch series, I made it such that
libusb_get_pollfds() would work on Windows platforms. As I was reworking
the patch series, I grew less fond of having a POSIX-specific concept being
applied to Windows, so I now have the following proposals for additions to
the API:
libusb_event_sources_handle_timeouts()
libusb_get_event_sources()
libusb_free_event_sources()
libusb_set_event_source_notifiers()
There will be a new structure as follows:
struct libusb_event_source {
libusb_os_handle source;
short events;
};
The libusb_os_handle type will be either an int or HANDLE type for
non-Windows and Windows platforms, respectively. Are there any objections
to this typedef name? I don't love it but don't have a better one.
Unless anyone disagrees, I don't think it is worthwhile to conditionally
define the 'events' field in this structure based on the platform. A
fixed-presence field, regardless of whether it is used or not, seems safer
to me.
I then would like the types and functions associated with pollfds to be
marked as deprecated, using the LIBUSB_DEPRECATED_FOR annotation that we
already have. The functions themselves will not be removed, for obvious ABI
reasons.
This brings me to library versioning. Per
http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html,
we have not been following the correct approach in regards to adding new
functions to the API. With this event abstraction patch, I propose the
following changes:
1) Bumping the current and age in the libtool version. This will yield a
library with a soname of libusb-1.0.so.0 and a filename of
libusb-1.0.so.0.2.0
2) Changing libusb's internal version to 1.1.0. The header file directory
and library name all have 'libusb-1.0' in their name...does this matter?
Regards,
Chris
I have finally been able to get back to working on the event abstraction
effort. In the initial patch series, I made it such that
libusb_get_pollfds() would work on Windows platforms. As I was reworking
the patch series, I grew less fond of having a POSIX-specific concept being
applied to Windows, so I now have the following proposals for additions to
the API:
libusb_event_sources_handle_timeouts()
libusb_get_event_sources()
libusb_free_event_sources()
libusb_set_event_source_notifiers()
There will be a new structure as follows:
struct libusb_event_source {
libusb_os_handle source;
short events;
};
The libusb_os_handle type will be either an int or HANDLE type for
non-Windows and Windows platforms, respectively. Are there any objections
to this typedef name? I don't love it but don't have a better one.
Unless anyone disagrees, I don't think it is worthwhile to conditionally
define the 'events' field in this structure based on the platform. A
fixed-presence field, regardless of whether it is used or not, seems safer
to me.
I then would like the types and functions associated with pollfds to be
marked as deprecated, using the LIBUSB_DEPRECATED_FOR annotation that we
already have. The functions themselves will not be removed, for obvious ABI
reasons.
This brings me to library versioning. Per
http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html,
we have not been following the correct approach in regards to adding new
functions to the API. With this event abstraction patch, I propose the
following changes:
1) Bumping the current and age in the libtool version. This will yield a
library with a soname of libusb-1.0.so.0 and a filename of
libusb-1.0.so.0.2.0
2) Changing libusb's internal version to 1.1.0. The header file directory
and library name all have 'libusb-1.0' in their name...does this matter?
Regards,
Chris