Skip to content

Commit

Permalink
Add lock(f, lock) docstring to lock. (#33796)
Browse files Browse the repository at this point in the history
Currently the `lock(l) do ; ... end` method is not documented, and so
is not discoverable.
  • Loading branch information
NHDaly authored and c42f committed Nov 9, 2019
1 parent 07535dd commit 8c34ad3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions base/lock.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ function relockall(rl::ReentrantLock, n::Int)
return
end

"""
lock(f::Function, lock)
Acquire the `lock`, execute `f` with the `lock` held, and release the `lock` when `f`
returns. If the lock is already locked by a different task/thread, wait for it to become
available.
When this function returns, the `lock` has been released, so the caller should
not attempt to `unlock` it.
"""
function lock(f, l::AbstractLock)
lock(l)
try
Expand Down

2 comments on commit 8c34ad3

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.