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

Replace ThreadLocals and add v thread ctx pooling #9

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

franz1981
Copy link
Contributor

No description provided.

@franz1981
Copy link
Contributor Author

@vietj Still not sure about the added test: I was expecting it to cause some external unpark, while it doesn't seem the case

@@ -97,38 +91,39 @@ public boolean isWorkerContext() {
private <T> void run(ContextInternal ctx, T value, Handler<T> task) {
Objects.requireNonNull(task, "Task handler must not be null");
scheduler.execute(() -> {
inThread.set(true);
var current = Thread.currentThread();
inThread.add(current);

Choose a reason for hiding this comment

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

I adopted this fix separately in my fork, it's an essential one

@@ -32,17 +33,21 @@ public Async(Vertx vertx, boolean useVirtualEventLoopThreads) {
* Run a task on a virtual thread
*/
public void run(Handler<Void> task) {
assert !Thread.currentThread().isVirtual();

Choose a reason for hiding this comment

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

I actually expect to be able to call .run from a virtual thread all the time

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