about summary refs log tree commit diff
path: root/src/libstd/sys/windows/os.rs
diff options
context:
space:
mode:
authorAaron Turon <aturon@mozilla.com>2014-12-14 00:05:32 -0800
committerAaron Turon <aturon@mozilla.com>2014-12-18 23:31:52 -0800
commita27fbac86849e07a0a6c746869d8f78319bd3a16 (patch)
treef17d75fcdd4d353f5ff919e491a5fc71252c0ef1 /src/libstd/sys/windows/os.rs
parent13f302d0c5dd3a88426da53ba07cdbe16459635b (diff)
downloadrust-a27fbac86849e07a0a6c746869d8f78319bd3a16.tar.gz
rust-a27fbac86849e07a0a6c746869d8f78319bd3a16.zip
Revise std::thread API to join by default
This commit is part of a series that introduces a `std::thread` API to
replace `std::task`.

In the new API, `spawn` returns a `JoinGuard`, which by default will
join the spawned thread when dropped. It can also be used to join
explicitly at any time, returning the thread's result. Alternatively,
the spawned thread can be explicitly detached (so no join takes place).

As part of this change, Rust processes now terminate when the main
thread exits, even if other detached threads are still running, moving
Rust closer to standard threading models. This new behavior may break code
that was relying on the previously implicit join-all.

In addition to the above, the new thread API also offers some built-in
support for building blocking abstractions in user space; see the module
doc for details.

Closes #18000

[breaking-change]
Diffstat (limited to 'src/libstd/sys/windows/os.rs')
-rw-r--r--src/libstd/sys/windows/os.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index 5c690180c44..2fbb9494c71 100644
--- a/src/libstd/sys/windows/os.rs
+++ b/src/libstd/sys/windows/os.rs
@@ -24,6 +24,9 @@ use path::{Path, GenericPath, BytesContainer};
 use ptr::{mod, RawPtr};
 use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
 use sys::fs::FileDesc;
+use option::Option;
+use option::Option::{Some, None};
+use slice;
 
 use os::TMPBUF_SZ;
 use libc::types::os::arch::extra::DWORD;
@@ -138,7 +141,7 @@ pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD) -> Option<String
                 // set `res` to None and continue.
                 let s = String::from_utf16(sub)
                     .expect("fill_utf16_buf_and_decode: closure created invalid UTF-16");
-                res = option::Some(s)
+                res = Some(s)
             }
         }
         return res;