Skip to content
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

Fix InterruptStop if called before InterruptRead #116

Conversation

emaxx-google
Copy link
Contributor

The goal is to make the polling termination (via
TAG_IFD_STOP_POLLING_THREAD) actually work even when it's triggered before the InterruptRead has a chance to create and publish the polling_transfer.

Without this patch, in some cases the termination was blocked for 10 minutes, because the thread that does InterruptStop might still see the null polling_transfer meanwhile the other thread is about to start this transfer. The proposed solution is to remember in a separate (atomic) boolean flag whether the termination started, to avoid this kind of race condition.

The goal is to make the polling termination (via
TAG_IFD_STOP_POLLING_THREAD) actually work even when it's
triggered before the InterruptRead has a chance to create and
publish the polling_transfer.

Without this patch, in some cases the termination was blocked for
10 minutes, because the thread that does InterruptStop might still
see the null polling_transfer meanwhile the other thread is about
to start this transfer. The proposed solution is to remember in a
separate (atomic) boolean flag whether the termination started, to
avoid this kind of race condition.
@emaxx-google emaxx-google marked this pull request as draft September 27, 2023 17:26
@emaxx-google emaxx-google marked this pull request as ready for review September 27, 2023 17:33
@LudovicRousseau LudovicRousseau merged commit eb7d606 into LudovicRousseau:master Sep 27, 2023
9 checks passed
emaxx-google added a commit to GoogleChromeLabs/chromeos_smart_card_connector that referenced this pull request Sep 27, 2023
Apply the fix that was submitted upstream:
LudovicRousseau/CCID#116.

This fixes #1078.
emaxx-google added a commit to GoogleChromeLabs/chromeos_smart_card_connector that referenced this pull request Sep 28, 2023
Apply the fix that was submitted upstream:
LudovicRousseau/CCID#116.

This fixes #1078.
@emaxx-google
Copy link
Contributor Author

Sorry, this change was incorrect. We should allow starting a new polling transfer after the previous one has been stopped. I've published an attempt to fix this problem: #119; alternatively, this PR needs to be reverted.

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.

None yet

2 participants