mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 06:34:54 +08:00
fix: 稳定并发 worker 回归测试
This commit is contained in:
@@ -221,6 +221,11 @@ mod tests {
|
|||||||
thread::sleep(Duration::from_millis(20));
|
thread::sleep(Duration::from_millis(20));
|
||||||
self.active.fetch_sub(1, Ordering::SeqCst);
|
self.active.fetch_sub(1, Ordering::SeqCst);
|
||||||
} else {
|
} else {
|
||||||
|
if task == 1 {
|
||||||
|
while self.active.load(Ordering::SeqCst) == 0 {
|
||||||
|
thread::yield_now();
|
||||||
|
}
|
||||||
|
}
|
||||||
if task == 2 && self.active.load(Ordering::SeqCst) > 0 {
|
if task == 2 && self.active.load(Ordering::SeqCst) > 0 {
|
||||||
self.task_two_started_while_task_zero_active
|
self.task_two_started_while_task_zero_active
|
||||||
.fetch_add(1, Ordering::SeqCst);
|
.fetch_add(1, Ordering::SeqCst);
|
||||||
|
|||||||
Reference in New Issue
Block a user