You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The various calls to grisu() are not thread-safe, due to the use of the module-level DIGITS buffer:
function grisu(v::AbstractFloat, mode, requested_digits)
return tuple(Base.Grisu.grisu(v, mode, requested_digits)..., Base.Grisu.DIGITS)
end
Different threads may write to this buffer before it is read by the calling function, causing corrupted output. In my particular case, this was corrupting the axis labels on plots generated in a parallel for loop.
This can be fixed by defining the function as:
function grisu(v::AbstractFloat, mode, requested_digits)
return tuple(Base.Grisu.grisu(v, mode, requested_digits)..., Base.Grisu.DIGITSs[Threads.threadid()])
end
The text was updated successfully, but these errors were encountered:
The various calls to
grisu()
are not thread-safe, due to the use of the module-level DIGITS buffer:Different threads may write to this buffer before it is read by the calling function, causing corrupted output. In my particular case, this was corrupting the axis labels on plots generated in a parallel for loop.
This can be fixed by defining the function as:
The text was updated successfully, but these errors were encountered: