diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2014-11-17 23:53:07 -0800 |
---|---|---|
committer | Chris Dickens <chris.dickens@hp.com> | 2014-12-19 11:12:04 -0800 |
commit | c57953cfb3c8ecd4c51d34b7a2982713925530cd (patch) | |
tree | 5503c683c08ed554a709b732897d80c67151044d /libusb/core.c | |
parent | 7ede4b76bdfec18850d1c3bbe87af6a0f69f76dc (diff) | |
download | libusb-c57953cfb3c8ecd4c51d34b7a2982713925530cd.tar.gz |
core: Rename pollfd_modify counter and its lock to device_close
This counter is now solely used for closing a device, so rename
the variable appropriately.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/core.c')
-rw-r--r-- | libusb/core.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libusb/core.c b/libusb/core.c index 997368a..5d1b48d 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -1399,19 +1399,19 @@ void API_EXPORTED libusb_close(libusb_device_handle *dev_handle) * thread from doing event handling) because we will be removing a file * descriptor from the polling loop. */ - /* record that we are messing with poll fds */ - usbi_mutex_lock(&ctx->pollfd_modify_lock); - ctx->pollfd_modify++; - usbi_mutex_unlock(&ctx->pollfd_modify_lock); + /* record that we are closing a device */ + usbi_mutex_lock(&ctx->device_close_lock); + ctx->device_close++; + usbi_mutex_unlock(&ctx->device_close_lock); /* write some data on control pipe to interrupt event handlers */ r = usbi_write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); if (r <= 0) { usbi_warn(ctx, "internal signalling write failed, closing anyway"); do_close(ctx, dev_handle); - usbi_mutex_lock(&ctx->pollfd_modify_lock); - ctx->pollfd_modify--; - usbi_mutex_unlock(&ctx->pollfd_modify_lock); + usbi_mutex_lock(&ctx->device_close_lock); + ctx->device_close--; + usbi_mutex_unlock(&ctx->device_close_lock); return; } @@ -1426,10 +1426,10 @@ void API_EXPORTED libusb_close(libusb_device_handle *dev_handle) /* Close the device */ do_close(ctx, dev_handle); - /* we're done with modifying poll fds */ - usbi_mutex_lock(&ctx->pollfd_modify_lock); - ctx->pollfd_modify--; - usbi_mutex_unlock(&ctx->pollfd_modify_lock); + /* we're done with closing this device */ + usbi_mutex_lock(&ctx->device_close_lock); + ctx->device_close--; + usbi_mutex_unlock(&ctx->device_close_lock); /* Release event handling lock and wake up event waiters */ libusb_unlock_events(ctx); |