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

Remove RefCell<Option> from PARKER #112

Merged
merged 1 commit into from
Jan 7, 2024
Merged

Conversation

taiki-e
Copy link
Collaborator

@taiki-e taiki-e commented Jan 7, 2024

No description provided.

@taiki-e
Copy link
Collaborator Author

taiki-e commented Jan 7, 2024

Nah, it is better to initialize the parker in the TLS initialization code than to do this.

@taiki-e taiki-e changed the title Use const thread_local Remove RefCell<Option> from PARKER Jan 7, 2024
@taiki-e
Copy link
Collaborator Author

taiki-e commented Jan 7, 2024

Ok, removed both RefCell and Option from it.

@taiki-e taiki-e requested a review from notgull January 7, 2024 05:16
@taiki-e
Copy link
Collaborator Author

taiki-e commented Jan 7, 2024

event-listener/src/lib.rs

Lines 1060 to 1062 in b1d437a

let mut pair = parker
.try_borrow_mut()
.expect("Shouldn't be able to borrow parker reentrantly");

Is RefCell used to detect reentrant parking? This seems true in other places (futures-lite, async-io) where we need to wait for arbitrary futures, but that should not happen in event-listener, right?

Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@taiki-e taiki-e merged commit 5f5135e into master Jan 7, 2024
9 checks passed
@taiki-e taiki-e deleted the taiki-e/const-thread-local branch January 7, 2024 13:28
@notgull
Copy link
Member

notgull commented Jan 7, 2024

Is RefCell used to detect reentrant parking? This seems true in other places (futures-lite, async-io) where we need to wait for arbitrary futures, but that should not happen in event-listener, right?

This is right, since you can't run arbitrary code while parked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants