Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Provide a Thread.yield method.
  • Loading branch information
jnthn committed Oct 31, 2013
1 parent cf66175 commit adf8221
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vm/jvm/core/Threading.pm
Expand Up @@ -49,6 +49,10 @@ my class Thread {
multi method Str(Thread:D:) {
"Thread<$.id>($.name)"
}

method yield(Thread:U:) {
nqp::jvmbootinterop().typeForName('java.lang.Thread').yield();
}
}

{
Expand Down

1 comment on commit adf8221

@BenGoldberg1
Copy link

Choose a reason for hiding this comment

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

I would expect Thread.yield to both call the underlying vm's yield, and do the perl equivalent -- reschedule the current Thread after all other Tasks.

Please sign in to comment.