Skip to content

Commit

Permalink
turn off TimerOutputs when using threads
Browse files Browse the repository at this point in the history
  • Loading branch information
marius311 committed Apr 27, 2021
1 parent 7f6dacd commit adead5a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,17 @@ end
See [`@⌛`](@ref)
"""
macro show⌛(ex)
quote
reset_timer!(get_defaulttimer())
result = $(esc(ex))
show(get_defaulttimer())
result
if Threads.nthreads()>1
# TimerOutputs is not thread-safe
# https://github.com/KristofferC/TimerOutputs.jl/issues/72
esc(ex)
else
quote
reset_timer!(get_defaulttimer())
result = $(esc(ex))
show(get_defaulttimer())
result
end
end
end

Expand Down

0 comments on commit adead5a

Please sign in to comment.