mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-28 10:09:25 -05:00
Fix race condition in v8::platform::Task tests (#355)
This commit is contained in:
parent
3d0a90c1c8
commit
d3a6c1403b
1 changed files with 16 additions and 16 deletions
|
@ -208,21 +208,21 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_task_1() {
|
||||
let mut task = TestTask::new();
|
||||
task.run();
|
||||
drop(task);
|
||||
assert_eq!(RUN_COUNT.swap(0, SeqCst), 1);
|
||||
assert_eq!(DROP_COUNT.swap(0, SeqCst), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_task_2() {
|
||||
let mut task = Box::new(TestTask::new()).into_unique_ref();
|
||||
task.run();
|
||||
task.run();
|
||||
drop(task);
|
||||
assert_eq!(RUN_COUNT.swap(0, SeqCst), 2);
|
||||
assert_eq!(DROP_COUNT.swap(0, SeqCst), 1);
|
||||
fn test_task() {
|
||||
{
|
||||
let mut task = TestTask::new();
|
||||
task.run();
|
||||
drop(task);
|
||||
assert_eq!(RUN_COUNT.swap(0, SeqCst), 1);
|
||||
assert_eq!(DROP_COUNT.swap(0, SeqCst), 1);
|
||||
}
|
||||
{
|
||||
let mut task = Box::new(TestTask::new()).into_unique_ref();
|
||||
task.run();
|
||||
task.run();
|
||||
drop(task);
|
||||
assert_eq!(RUN_COUNT.swap(0, SeqCst), 2);
|
||||
assert_eq!(DROP_COUNT.swap(0, SeqCst), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue