Skip to content

Fix transfer pool thread safety #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2015
Merged

Fix transfer pool thread safety #275

merged 1 commit into from
Jun 8, 2015

Conversation

xlz
Copy link
Member

@xlz xlz commented Jun 8, 2015

Avoid unsafe access during transfer resubmission by refactoring TransferPool using std::vector. It seems there is no need to maintain a queue for the case when a transfer may temporarily fail and recover. If one transfer fails, it is likely all will fail permanently.

Each transfer is independent during runtime and no lock is needed.

Wait for all transfers during cancellation, when the only lock in the TransferPool protects the counter of stopped transfers. Though coarse-grained, this lock will not have effect on runtime performance.

This has been tested on Linux, Windows, and Mac. No crashes are observed, and shutdown time is reduced.

This PR proposes to subsume #212.

Avoid unsafe access during transfer resubmission by refactoring
TransferPool using std::vector.
Wait for all transfers during cancellation.
@floe floe added this to the 0.1 milestone Jun 8, 2015
@gaborpapp
Copy link
Contributor

Tested. Cleaner and faster shutdown. Seems to work well.

@HenningJ
Copy link
Contributor

HenningJ commented Jun 8, 2015

Tested on Windows. Works great.

floe added a commit that referenced this pull request Jun 8, 2015
Fix transfer pool thread safety
@floe floe merged commit 1c13b2c into OpenKinect:master Jun 8, 2015
@xlz xlz deleted the transfer-pool branch September 13, 2015 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants