Remove yield APIs#52
Conversation
WalkthroughReplaces thread-local process identity handling with a single public Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Erlang caller
participant Beam as beam.zig
Note over Caller,Beam #D6EAF8: New flow
Caller->>Beam: call self(environment)
Beam-->>Caller: pid | error("Fail to get calling process")
sequenceDiagram
participant Caller as Erlang caller
participant Beam as beam.zig (old)
Note over Caller,Beam #FDEBD0: Previous (removed) flow
Caller->>Beam: thread-local self lookup
alt thread-local set
Beam-->>Caller: pid
else not set
Beam-->>Caller: Function clause error (was)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20-25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/beam.zig (1)
706-713: Consider simplifying the return value.The function correctly handles the case where the environment is not process-bound. However, since
enif_selffills in thepvariable that was passed as the second argument, andself_valis just a pointer to that same structure, you could simplify by returningpdirectly:Apply this diff to simplify the implementation:
pub fn self(environment: env) !pid { var p: pid = undefined; - if (e.enif_self(environment, @ptrCast(&p))) |self_val| { - return self_val.*; + if (e.enif_self(environment, @ptrCast(&p))) |_| { + return p; } else { return Error.@"Fail to get calling process"; } }This matches the pattern used in
get_pidat line 690-697.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/beam.zig(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: otp25.0-ex1.16.2 / ubuntu-22.04
🔇 Additional comments (2)
src/beam.zig (2)
270-270: LGTM! Clear error variant added.The new error variant "Fail to get calling process" is appropriately named and follows the existing error naming conventions in the Error enum.
706-713: The review comment is based on incorrect information about the changes.The comprehensive search across the entire codebase found zero references to any of the supposedly removed APIs (
generic_self,threaded_self,set_generic_self,set_threaded_self,yield_info,YieldError,YieldState,YieldInfo,set_yield_response,yield()). These functions do not exist in the repository. The code change at lines 706-713 introduces a newself()wrapper function arounde.enif_self()for convenience—it is not a replacement for removed APIs.Likely an incorrect or invalid review comment.
Summary by CodeRabbit
Chores
Refactor
Bug Fixes / Reliability