]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/sync/barrier.rs
Use explicit wrapping_add to prevent potential unexpected behavior on debug builds
[rust.git] / src / libstd / sync / barrier.rs
index a7b01e49d2bb625f2654b1bd13d5e30c81fae272..273c7c1c54a2a902dbde9d3c6318fbae59ea1715 100644 (file)
@@ -152,7 +152,7 @@ pub fn wait(&self) -> BarrierWaitResult {
             BarrierWaitResult(false)
         } else {
             lock.count = 0;
-            lock.generation_id += 1;
+            lock.generation_id = lock.generation_id.wrapping_add(1);
             self.cvar.notify_all();
             BarrierWaitResult(true)
         }