}
}
+ /// A version of `UnsafeCell` intended for use in concurrent data
+ /// structures (for example, you might put it in an `Arc`).
+ struct RacyCell<T>(pub UnsafeCell<T>);
+
+ impl<T> RacyCell<T> {
+
+ fn new(value: T) -> RacyCell<T> {
+ RacyCell(UnsafeCell { value: value })
+ }
+
+ unsafe fn get(&self) -> *mut T {
+ self.0.get()
+ }
+
+ }
+
+ unsafe impl<T:Send> Send for RacyCell<T> { }
+
+ unsafe impl<T> kinds::Sync for RacyCell<T> { } // Oh dear
+
+
#[cfg(test)]
mod test {
+ use super::*;
use prelude::*;
-
use os;
- use super::*;
pub fn stress_factor() -> uint {
match os::getenv("RUST_TEST_STRESS") {