diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-05-27 11:18:36 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2015-05-27 11:19:03 +0300 |
| commit | 377b0900aede976b2d37a499bbd7b62c2e39b358 (patch) | |
| tree | b4a5a4431d36ed1a4e0a39c7d2ef2563ecac9bf4 /src/libstd/sys/windows/condvar.rs | |
| parent | 6e8e4f847c2ea02fec021ea15dfb2de6beac797a (diff) | |
| download | rust-377b0900aede976b2d37a499bbd7b62c2e39b358.tar.gz rust-377b0900aede976b2d37a499bbd7b62c2e39b358.zip | |
Use `const fn` to abstract away the contents of UnsafeCell & friends.
Diffstat (limited to 'src/libstd/sys/windows/condvar.rs')
| -rw-r--r-- | src/libstd/sys/windows/condvar.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libstd/sys/windows/condvar.rs b/src/libstd/sys/windows/condvar.rs index 8bb2326e4d6..baa7d1ceea3 100644 --- a/src/libstd/sys/windows/condvar.rs +++ b/src/libstd/sys/windows/condvar.rs @@ -22,13 +22,10 @@ pub struct Condvar { inner: UnsafeCell<ffi::CONDITION_VARIABLE> } unsafe impl Send for Condvar {} unsafe impl Sync for Condvar {} -pub const CONDVAR_INIT: Condvar = Condvar { - inner: UnsafeCell { value: ffi::CONDITION_VARIABLE_INIT } -}; - impl Condvar { - #[inline] - pub unsafe fn new() -> Condvar { CONDVAR_INIT } + pub const fn new() -> Condvar { + Condvar { inner: UnsafeCell::new(ffi::CONDITION_VARIABLE_INIT) } + } #[inline] pub unsafe fn wait(&self, mutex: &Mutex) { |
