-// 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;
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<()>;
}
}
+ #[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>> {
pub fn yield_now() {
assert_eq!(
- usercalls::wait(0, usercalls::WAIT_NO).unwrap_err().kind(),
+ usercalls::wait(0, usercalls::raw::WAIT_NO).unwrap_err().kind(),
io::ErrorKind::WouldBlock
);
}