Skip to content

Commit 689f985

Browse files
authored
Fix log_message pileup (#2750)
"libuv will coalesce calls to uv_async_send(), that is, not every call to it will yield an execution of the callback."
1 parent 7ea3415 commit 689f985

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/cudnn/src/cuDNN.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,12 @@ function __init__()
183183
# register a log callback
184184
if !precompiling && (isdebug(:init, cuDNN) || Base.JLOptions().debug_level >= 2)
185185
log_cond[] = Base.AsyncCondition() do async_cond
186-
message = Base.@lock log_lock popfirst!(log_messages)
187-
_log_message(message...)
186+
Base.@lock log_lock begin
187+
while length(log_messages) > 0
188+
message = popfirst!(log_messages)
189+
_log_message(message...)
190+
end
191+
end
188192
end
189193

190194
callback = @cfunction(log_message, Nothing,

0 commit comments

Comments
 (0)