diff options
| author | bors <bors@rust-lang.org> | 2022-10-15 10:45:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-15 10:45:36 +0000 |
| commit | c93ef33700e4e4f84fd85690df71b14c1d2b0aa3 (patch) | |
| tree | 40279eedaa7be0baa64437557b50667ac5bf4f2a /library/std/src/thread | |
| parent | b15e2c129e732fb3f1ff3c707d76341047a66af0 (diff) | |
| parent | ac23c9fde9b5298d2151e374b890c91c342fb17e (diff) | |
| download | rust-c93ef33700e4e4f84fd85690df71b14c1d2b0aa3.tar.gz rust-c93ef33700e4e4f84fd85690df71b14c1d2b0aa3.zip | |
Auto merge of #103083 - Dylan-DPC:rollup-97cvwdv, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #102773 (Use semaphores for thread parking on Apple platforms) - #102884 (resolve: Some cleanup, asserts and tests for lifetime ribs) - #102954 (Add missing checks for `doc(cfg_hide(...))`) - #102998 (Drop temporaries created in a condition, even if it's a let chain) - #103003 (Fix `suggest_floating_point_literal` ICE) - #103041 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/thread')
| -rw-r--r-- | library/std/src/thread/tests.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/library/std/src/thread/tests.rs b/library/std/src/thread/tests.rs index 130e47c8d44..dfb8765ab4e 100644 --- a/library/std/src/thread/tests.rs +++ b/library/std/src/thread/tests.rs @@ -245,6 +245,28 @@ fn test_try_panic_any_message_unit_struct() { } #[test] +fn test_park_unpark_before() { + for _ in 0..10 { + thread::current().unpark(); + thread::park(); + } +} + +#[test] +fn test_park_unpark_called_other_thread() { + for _ in 0..10 { + let th = thread::current(); + + let _guard = thread::spawn(move || { + super::sleep(Duration::from_millis(50)); + th.unpark(); + }); + + thread::park(); + } +} + +#[test] fn test_park_timeout_unpark_before() { for _ in 0..10 { thread::current().unpark(); |
