Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup of wasm #84655

Merged
merged 4 commits into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/std/src/sys/unsupported/args.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::ffi::OsString;
use crate::fmt;

pub struct Args {}

Expand Down
42 changes: 0 additions & 42 deletions library/std/src/sys/wasm/args.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,10 @@ impl Thread {
unsupported()
}

pub fn yield_now() {
// do nothing
}
pub fn yield_now() {}

pub fn set_name(_name: &CStr) {
// nope
}
pub fn set_name(_name: &CStr) {}

#[cfg(not(target_feature = "atomics"))]
pub fn sleep(_dur: Duration) {
panic!("can't sleep");
}

#[cfg(target_feature = "atomics")]
pub fn sleep(dur: Duration) {
use crate::arch::wasm32;
use crate::cmp;
Expand All @@ -46,9 +36,7 @@ impl Thread {
}
}

pub fn join(self) {
self.0
}
pub fn join(self) {}
}

pub mod guard {
Expand All @@ -61,11 +49,9 @@ pub mod guard {
}
}

// This is only used by atomics primitives when the `atomics` feature is
// enabled. In that mode we currently just use our own thread-local to store our
// We currently just use our own thread-local to store our
// current thread's ID, and then we lazily initialize it to something allocated
// from a global counter.
#[cfg(target_feature = "atomics")]
pub fn my_id() -> u32 {
use crate::sync::atomic::{AtomicU32, Ordering::SeqCst};

Expand Down
14 changes: 9 additions & 5 deletions library/std/src/sys/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#![deny(unsafe_op_in_unsafe_fn)]

pub mod alloc;
#[path = "../unsupported/args.rs"]
pub mod args;
#[path = "../unsupported/cmath.rs"]
pub mod cmath;
Expand All @@ -37,7 +38,6 @@ pub mod pipe;
pub mod process;
#[path = "../unsupported/stdio.rs"]
pub mod stdio;
pub mod thread;
#[path = "../unsupported/thread_local_dtor.rs"]
pub mod thread_local_dtor;
#[path = "../unsupported/thread_local_key.rs"]
Expand All @@ -49,21 +49,25 @@ pub use crate::sys_common::os_str_bytes as os_str;

cfg_if::cfg_if! {
if #[cfg(target_feature = "atomics")] {
#[path = "condvar_atomics.rs"]
#[path = "atomics/condvar.rs"]
pub mod condvar;
#[path = "mutex_atomics.rs"]
#[path = "atomics/mutex.rs"]
pub mod mutex;
#[path = "rwlock_atomics.rs"]
#[path = "atomics/rwlock.rs"]
pub mod rwlock;
#[path = "futex_atomics.rs"]
#[path = "atomics/futex.rs"]
pub mod futex;
#[path = "atomics/thread.rs"]
pub mod thread;
} else {
#[path = "../unsupported/condvar.rs"]
pub mod condvar;
#[path = "../unsupported/mutex.rs"]
pub mod mutex;
#[path = "../unsupported/rwlock.rs"]
pub mod rwlock;
#[path = "../unsupported/thread.rs"]
pub mod thread;
}
}

Expand Down