Skip to content

Commit

Permalink
Fiber ext was moved into core in 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Oct 25, 2023
1 parent fbce6e2 commit 2779806
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ private void initBootLibraries() {
loadService.provide("rational.rb");
loadService.provide("complex.rb");
loadService.provide("thread.rb");
loadService.provide("fiber.rb");
loadService.provide("ruby2_keywords.rb");

// Load preludes
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/ext/fiber/ThreadFiber.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private static void handleExceptionDuringExchange(ThreadContext context, FiberDa
}

@JRubyMethod(rest = true)
public IRubyObject __transfer__(ThreadContext context, IRubyObject[] values) {
public IRubyObject transfer(ThreadContext context, IRubyObject[] values) {
Ruby runtime = context.runtime;

final FiberData data = this.data;
Expand Down Expand Up @@ -455,13 +455,13 @@ private static FiberData verifyCurrentFiber(ThreadContext context, Ruby runtime)
return currentFiberData;
}

@JRubyMethod
public IRubyObject __alive__(ThreadContext context) {
@JRubyMethod(name = "alive?")
public IRubyObject alive_p(ThreadContext context) {
return RubyBoolean.newBoolean(context, alive());
}

@JRubyMethod(meta = true)
public static IRubyObject __current__(ThreadContext context, IRubyObject recv) {
public static IRubyObject current(ThreadContext context, IRubyObject recv) {
return context.getFiber();
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/ruby/jruby/kernel/enumerator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def next?
end

def next
reset unless @fiber&.__alive__
reset unless @fiber&.alive?

val = @fiber.resume

Expand All @@ -109,7 +109,7 @@ def next

def rewind
fiber, @fiber = @fiber, nil
fiber.send(:__finalize__) if fiber&.__alive__
fiber.send(:__finalize__) if fiber&.alive?
@state.done = false
end

Expand Down
12 changes: 0 additions & 12 deletions lib/ruby/stdlib/fiber.rb

This file was deleted.

0 comments on commit 2779806

Please sign in to comment.