-
Notifications
You must be signed in to change notification settings - Fork 27
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
Use interruptGuard in VThreadScheduler #37
Conversation
@@ -13,11 +14,14 @@ object VThreadScheduler extends Scheduler: | |||
override def execute(body: Runnable): Unit = VTFactory.newThread(body) | |||
|
|||
override def schedule(delay: FiniteDuration, body: Runnable): Cancellable = | |||
val interruptGuard = AtomicBoolean(true) // to avoid interrupting the body |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great but use varHandle to reduce memory usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@He-Pin can you elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like atomic interger field updater, which can reduce the 4byte ref of the object wrapper.
@m8nmueller @He-Pin I implemented the VarHandle approach, please have a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just commented, @natsukagami
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, maybe I can try it with pekko some day:)
A simple solution to this double scheduling. Allocate
AtomicBoolean
vs a new virtual thread.Happy New Year! 🎉