File tree Expand file tree Collapse file tree 1 file changed +3
-19
lines changed
tests/run-pass/concurrency Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Original file line number Diff line number Diff line change 2
2
3
3
//! Check that destructors of the library thread locals are executed immediately
4
4
//! after a thread terminates.
5
- //!
6
- //! FIXME: We should have a similar test for thread-local statics (statics
7
- //! annotated with `#[thread_local]`) once they support destructors.
8
-
9
- #![ feature( thread_local_internals) ]
10
5
11
6
use std:: cell:: RefCell ;
12
7
use std:: thread;
@@ -21,20 +16,9 @@ impl Drop for TestCell {
21
16
}
22
17
}
23
18
24
- static A : std:: thread:: LocalKey < TestCell > = {
25
- #[ inline]
26
- fn __init ( ) -> TestCell {
27
- TestCell { value : RefCell :: new ( 0 ) }
28
- }
29
-
30
- unsafe fn __getit ( ) -> Option < & ' static TestCell > {
31
- static __KEY: std:: thread:: __OsLocalKeyInner < TestCell > =
32
- std:: thread:: __OsLocalKeyInner:: new ( ) ;
33
- __KEY. get ( __init)
34
- }
35
-
36
- unsafe { std:: thread:: LocalKey :: new ( __getit) }
37
- } ;
19
+ thread_local ! {
20
+ static A : TestCell = TestCell { value: RefCell :: new( 0 ) } ;
21
+ }
38
22
39
23
fn main ( ) {
40
24
thread:: spawn ( || {
You can’t perform that action at this time.
0 commit comments