10
10
11
11
#![ allow( non_camel_case_types) ]
12
12
13
+ use rustc_data_structures:: sync:: Lock ;
14
+
13
15
use std:: cell:: { RefCell , Cell } ;
14
16
use std:: collections:: HashMap ;
15
17
use std:: ffi:: CString ;
@@ -35,7 +37,7 @@ pub struct ErrorReported;
35
37
thread_local ! ( static TIME_DEPTH : Cell <usize > = Cell :: new( 0 ) ) ;
36
38
37
39
/// Initialized for -Z profile-queries
38
- thread_local ! ( static PROFQ_CHAN : RefCell <Option <Sender <ProfileQueriesMsg >>> = RefCell :: new( None ) ) ;
40
+ rustc_global ! ( static PROFQ_CHAN : Lock <Option <Sender <ProfileQueriesMsg >>> = Lock :: new( None ) ) ;
39
41
40
42
/// Parameters to the `Dump` variant of type `ProfileQueriesMsg`.
41
43
#[ derive( Clone , Debug ) ]
@@ -77,7 +79,7 @@ pub enum ProfileQueriesMsg {
77
79
78
80
/// If enabled, send a message to the profile-queries thread
79
81
pub fn profq_msg ( msg : ProfileQueriesMsg ) {
80
- PROFQ_CHAN . with ( |sender|{
82
+ rustc_access_global ! ( PROFQ_CHAN , |sender| {
81
83
if let Some ( s) = sender. borrow( ) . as_ref( ) {
82
84
s. send( msg) . unwrap( )
83
85
} else {
@@ -93,7 +95,7 @@ pub fn profq_msg(msg: ProfileQueriesMsg) {
93
95
94
96
/// Set channel for profile queries channel
95
97
pub fn profq_set_chan ( s : Sender < ProfileQueriesMsg > ) -> bool {
96
- PROFQ_CHAN . with ( |chan|{
98
+ rustc_access_global ! ( PROFQ_CHAN , |chan| {
97
99
if chan. borrow( ) . is_none( ) {
98
100
* chan. borrow_mut( ) = Some ( s) ;
99
101
true
0 commit comments