Permalink
Browse files

std: Move spawn_high_level_loop to uv::hl

  • Loading branch information...
1 parent d4db1be commit 59262dfc6280b81f56129aaa6deaf2f74c63efa6 @brson brson committed May 25, 2012
Showing with 31 additions and 28 deletions.
  1. +2 −26 src/libstd/uv_global_loop.rs
  2. +29 −2 src/libstd/uv_hl.rs
@@ -7,7 +7,6 @@ export get, get_monitor_task_gl;
import ll = uv_ll;
import hl = uv_hl;
import get_gl = get;
-import task::{run, single_threaded};
import priv::{chan_from_global_ptr, weaken_task};
import comm::{port, chan, methods, select2, listen};
import either::{left, right};
@@ -45,7 +44,7 @@ fn get_monitor_task_gl() -> hl::high_level_loop unsafe {
task::set_opts(builder, {
supervise: false,
sched: some({
- mode: single_threaded,
+ mode: task::single_threaded,
native_stack_size: none
})
with task::get_opts(builder)
@@ -111,30 +110,7 @@ fn spawn_loop() -> hl::high_level_loop unsafe {
}
}
}
- spawn_high_level_loop(builder)
-}
-
-fn spawn_high_level_loop(-builder: task::builder
- ) -> hl::high_level_loop unsafe {
-
- let hll_po = port::<hl::high_level_loop>();
- let hll_ch = hll_po.chan();
-
- task::set_opts(builder, {
- sched: some({
- mode: single_threaded,
- native_stack_size: none
- })
- with task::get_opts(builder)
- });
-
- run(builder) {||
- #debug("entering libuv task");
- hl::run_high_level_loop(hll_ch);
- #debug("libuv task exiting");
- };
-
- hll_po.recv()
+ hl::spawn_high_level_loop(builder)
}
#[cfg(test)]
View
@@ -6,8 +6,10 @@ provide a high-level, abstracted interface to some set of
libuv functionality.
"];
-export high_level_loop, high_level_msg;
-export run_high_level_loop, interact, exit;
+export high_level_loop;
+export spawn_high_level_loop;
+export interact;
+export exit;
import libc::c_void;
import ptr::addr_of;
@@ -22,6 +24,31 @@ enum high_level_loop = {
op_chan: chan<high_level_msg>
};
+fn spawn_high_level_loop(-builder: task::builder
+ ) -> high_level_loop unsafe {
+
+ import task::{set_opts, get_opts, single_threaded, run};
+
+ let hll_po = port::<high_level_loop>();
+ let hll_ch = hll_po.chan();
+
+ set_opts(builder, {
+ sched: some({
+ mode: single_threaded,
+ native_stack_size: none
+ })
+ with get_opts(builder)
+ });
+
+ run(builder) {||
+ #debug("entering libuv task");
+ run_high_level_loop(hll_ch);
+ #debug("libuv task exiting");
+ };
+
+ hll_po.recv()
+}
+
#[doc="
Represents the range of interactions with a `high_level_loop`
"]

0 comments on commit 59262df

Please sign in to comment.