]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/sys/sgx/thread.rs
SGX target: fix std unit tests
[rust.git] / src / libstd / sys / sgx / thread.rs
index b8d5b17d8d2d9c76b6dadbc27a03436ca9f51c61..a3637723ba1bd05611daf419248562941587fce7 100644 (file)
@@ -1,17 +1,8 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use boxed::FnBox;
-use ffi::CStr;
-use io;
-use time::Duration;
+#![cfg_attr(test, allow(dead_code))] // why is this necessary?
+use crate::boxed::FnBox;
+use crate::ffi::CStr;
+use crate::io;
+use crate::time::Duration;
 
 use super::abi::usercalls;
 
@@ -20,9 +11,9 @@
 pub const DEFAULT_MIN_STACK_SIZE: usize = 4096;
 
 mod task_queue {
-    use sync::{Mutex, MutexGuard, Once};
-    use sync::mpsc;
-    use boxed::FnBox;
+    use crate::sync::{Mutex, MutexGuard, Once};
+    use crate::sync::mpsc;
+    use crate::boxed::FnBox;
 
     pub type JoinHandle = mpsc::Receiver<()>;
 
@@ -43,7 +34,11 @@ pub(super) fn run(self) {
         }
     }
 
+    #[cfg_attr(test, linkage = "available_externally")]
+    #[export_name = "_ZN16__rust_internals3std3sys3sgx6thread15TASK_QUEUE_INITE"]
     static TASK_QUEUE_INIT: Once = Once::new();
+    #[cfg_attr(test, linkage = "available_externally")]
+    #[export_name = "_ZN16__rust_internals3std3sys3sgx6thread10TASK_QUEUEE"]
     static mut TASK_QUEUE: Option<Mutex<Vec<Task>>> = None;
 
     pub(super) fn lock() -> MutexGuard<'static, Vec<Task>> {