qutip / QuantumToolbox.jl

Quantum Toolbox in Julia
https://qutip.org/QuantumToolbox.jl/
BSD 3-Clause "New" or "Revised" License
46 stars 16 forks source link

Improve ProgressBar thread safety #212

Closed albertomercurio closed 2 months ago

albertomercurio commented 2 months ago

Description

I improved the thread safety of ProgressBar. Indeed, the previous_time variable was updated in a non-thread-safe way. I converted it into a Threads.Atomic object and then performed atomic operations on it.

Then, I also included a ReentrantLock in order to be sure that the print functions are thread-safe.

Finally, I changed the ProgressBar struct to ummutable, improving performances.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.27%. Comparing base (d469d80) to head (e7271a3). Report is 3 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #212 +/- ## ========================================== + Coverage 93.26% 93.27% +0.01% ========================================== Files 29 29 Lines 2167 2172 +5 ========================================== + Hits 2021 2026 +5 Misses 146 146 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.