Improve read performance when the buffer size is limited


Read notifications should be enabled all the time while the device is
opened unless the buffer size limit is reached. To enable the read
notifier again, the user needs to read the data or enlarge the buffer
with a setReadBufferSize() call.

According to that scenario, it's very likely that the device will
toggle the state of notifier twice (on->off->on) in one notification
cycle. This patch prevents this unnecessary toggling by:

- unconditionally setting the notifier's state in setReadBufferSize()/
  readData();
- deferring the notification disabling in readNotification() on Unix
  and in completeAsyncRead() on Windows to the next notification
  cycle.

Change-Id: I97fc041bb705c034a7e73d1437e64b9b34dc2c18
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
commit84221c27840529bccb3d50c7e2da26b40a310e18
parenta5ecc626bc6cf4e0890150acabcbff3a8d9af871
authorAlex Trotsenko <alex1973tr@gmail.com>
committerAlex Trotsenko <alex1973tr@gmail.com>
commit timeWed, 26 Apr 2017 11:50:44 +0000