diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-12-12 21:38:57 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-12-24 19:59:52 -0800 |
| commit | 018d60509c04cdebdf8b0d9e2b58f2604538e516 (patch) | |
| tree | 00245c6192d883dbc4d45cbb10a314c4e2239d07 /src/libnative | |
| parent | d830fcc6eb5173061888d4b128c0670a49515f58 (diff) | |
| download | rust-018d60509c04cdebdf8b0d9e2b58f2604538e516.tar.gz rust-018d60509c04cdebdf8b0d9e2b58f2604538e516.zip | |
std: Get stdtest all passing again
This commit brings the library up-to-date in order to get all tests passing again
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/task.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libnative/task.rs b/src/libnative/task.rs index fa7500ca85e..782bef10c92 100644 --- a/src/libnative/task.rs +++ b/src/libnative/task.rs @@ -22,7 +22,7 @@ use std::rt::task::{Task, BlockedTask}; use std::rt::thread::Thread; use std::rt; use std::sync::atomics::{AtomicUint, SeqCst, INIT_ATOMIC_UINT}; -use std::task::TaskOpts; +use std::task::{TaskOpts, default_task_opts}; use std::unstable::mutex::{Mutex, MUTEX_INIT}; use std::unstable::stack; @@ -73,9 +73,14 @@ pub fn new() -> ~Task { return task; } +/// Spawns a function with the default configuration +pub fn spawn(f: proc()) { + spawn_opts(default_task_opts(), f) +} + /// Spawns a new task given the configuration options and a procedure to run /// inside the task. -pub fn spawn(opts: TaskOpts, f: proc()) { +pub fn spawn_opts(opts: TaskOpts, f: proc()) { // must happen before the spawn, no need to synchronize with a lock. unsafe { THREAD_CNT.fetch_add(1, SeqCst); } @@ -238,7 +243,7 @@ impl rt::Runtime for Ops { cur_task.put_runtime(self as ~rt::Runtime); Local::put(cur_task); - task::spawn(opts, f); + task::spawn_opts(opts, f); } fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>> { |
