Skip to content

Commit

Permalink
Document finalizer task-switch restriction (JuliaLang#25141)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihnorton authored and StefanKarpinski committed Jul 5, 2019
1 parent 2350c04 commit 95ebe8f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/gcutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
Register a function `f(x)` to be called when there are no program-accessible references to
`x`, and return `x`. The type of `x` must be a `mutable struct`, otherwise the behavior of
this function is unpredictable.
`f` must not cause a task switch, which excludes most I/O operations such as `println`.
`@schedule println("message")` or `ccall(:jl_, Void, (Any,), "message")` may be helpful for
debugging purposes.
"""
function finalizer(@nospecialize(f), @nospecialize(o))
if isimmutable(o)
Expand Down

0 comments on commit 95ebe8f

Please sign in to comment.