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

Make the crate no-std #4

Merged
merged 1 commit into from Jul 10, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -3,7 +3,7 @@ name = "try-lock"
version = "0.2.2" # remember to update html_root_url
description = "A lightweight atomic lock."
keywords = ["lock", "atomic"]
categories = ["concurrency"]
categories = ["concurrency", "no-std"]
authors = ["Sean McArthur <sean@seanmonstar.com>"]
license = "MIT"
repository = "https://github.com/seanmonstar/try-lock"
Expand Down
12 changes: 8 additions & 4 deletions src/lib.rs
Expand Up @@ -2,6 +2,7 @@
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(warnings)]
#![cfg_attr(not(test), no_std)]

//! A light-weight lock guarded by an atomic boolean.
//!
Expand Down Expand Up @@ -43,10 +44,13 @@
//! assert_eq!(locked2.name, "Spanner Bundle");
//! ```

use std::cell::UnsafeCell;
use std::fmt;
use std::ops::{Deref, DerefMut};
use std::sync::atomic::{AtomicBool, Ordering};
#[cfg(test)]
extern crate core;

use core::cell::UnsafeCell;
use core::fmt;
use core::ops::{Deref, DerefMut};
use core::sync::atomic::{AtomicBool, Ordering};

/// A light-weight lock guarded by an atomic boolean.
///
Expand Down