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

erts: Add BIFs processes_iterator/0 and processes_next/1 #9129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Dec 9, 2024

  1. erts: Add BIFs processes_iterator/0 and processes_next/1

    This PR adds 2 BIFs to the `erlang` module.
    
    `processes_iterator/0` returns a process iterator that can be used to
    iterate through the process table.
    
    `process_next/1` takes in a process iterator and returns a 2-tuple,
    consisting of one process identifier and a new process iterator. If the
    process iterator runs out of processes in the process table, `none`
    will be returned.
    
    By using these 2 BIFs instead of `processes/0`, one can avoid creating
    a potentially huge list of the pids for all existing processes, at the
    cost of less consistency guarantees. Process identifiers returned from
    consecutive calls of `process_next/1` may not be a consistent snapshot
    of all elements existing in the table during any of the calls. The
    process identifier of a process that is alive before
    `processes_iterator/0` is called and continues to be alive until
    `processes_next/1` returns `none` is guaranteed to be part of the
    result returned from one of the calls to `processes_next/1`.
    lucioleKi committed Dec 9, 2024
    Configuration menu
    Copy the full SHA
    69f7884 View commit details
    Browse the repository at this point in the history