Use explicit wrapping_add to prevent potential unexpected behavior on debug builds

This commit is contained in:
Stefan Schindler 2017-08-01 16:25:36 +02:00
parent 0bf018c588
commit 702750c538

View File

@ -152,7 +152,7 @@ impl Barrier {
BarrierWaitResult(false) BarrierWaitResult(false)
} else { } else {
lock.count = 0; lock.count = 0;
lock.generation_id += 1; lock.generation_id = lock.generation_id.wrapping_add(1);
self.cvar.notify_all(); self.cvar.notify_all();
BarrierWaitResult(true) BarrierWaitResult(true)
} }