Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:19
erlang
1030-erlang-module-doc-preciser-description-of-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1030-erlang-module-doc-preciser-description-of-erlang-yie.patch of Package erlang
From a01ec2f8bb07dd566b95bf845a916a111c661d64 Mon Sep 17 00:00:00 2001 From: Kjell Winblad <kjellwinblad@gmail.com> Date: Thu, 17 Sep 2020 11:40:26 +0200 Subject: [PATCH 20/39] erlang module doc: preciser description of erlang:yield() --- erts/doc/src/erlang.xml | 22 ++++++++++++++-------- erts/preloaded/src/erlang.erl | 2 ++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 45b37db10d..2e8c9f5247 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -12155,16 +12155,22 @@ true</pre> <name name="yield" arity="0"/> <fsummary>Let other processes get a chance to execute.</fsummary> <desc> - <p>Voluntarily lets other processes (if any) get a chance to - execute. Using this function is similar to - <c>receive after 1 -> true end</c>, except that <c>yield()</c> - is faster.</p> + <p>Tries to give other processes with the same or + higher priority (if any) a chance to execute before + returning. There is no guarantee that any other process runs + between the invocation and return of <c>erlang:yield/0</c>.</p> + + <p>See the documentation for <seealso + marker="system/reference_manual:expressions#receive"><c>receive-after</c> + expressions</seealso> for how to make the current process + sleep for a specific number of milliseconds.</p> <warning> - <p>There is seldom or never any need to use this BIF, - especially in the SMP emulator, as other processes have a - chance to run in another scheduler thread anyway. + <p>There is seldom or never any need to use this BIF. Using this BIF without a thorough grasp of how the scheduler - works can cause performance degradation.</p> + works can cause performance degradation. The current implementation + of this function puts the current process last in the current + scheduler's queue for processes of the same priority as the + current process.</p> </warning> </desc> </func> diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index 700b84bf25..60caad2b1e 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -3335,6 +3335,8 @@ spawn_request_abandon(_ReqId) -> -spec erlang:yield() -> 'true'. yield() -> + % This is not an infinite loop because erlang:yield() is + % translated to an instruction by the loader erlang:yield(). -spec nodes() -> Nodes when -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor