diff options
| author | Michael Bebenita <[email protected]> | 2010-08-11 21:23:34 -0700 |
|---|---|---|
| committer | Michael Bebenita <[email protected]> | 2010-08-11 21:24:04 -0700 |
| commit | 988695a96cee1eb825435260a1874b8daa0e590a (patch) | |
| tree | ee92e117a653c8c6fad100e7416afe5468073ff3 /src/lib | |
| parent | Some ELF correctness issues, but apparently none enough to placate gdb. (diff) | |
| download | rust-988695a96cee1eb825435260a1874b8daa0e590a.tar.xz rust-988695a96cee1eb825435260a1874b8daa0e590a.zip | |
Added support for task sleeping in the scheduler.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/_task.rs | 12 | ||||
| -rw-r--r-- | src/lib/std.rc | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/_task.rs b/src/lib/_task.rs new file mode 100644 index 00000000..a12c2f27 --- /dev/null +++ b/src/lib/_task.rs @@ -0,0 +1,12 @@ +native "rust" mod rustrt { + fn task_sleep(uint time_in_us); +} + +/** + * Hints the scheduler to yield this task for a specified ammount of time. + * + * arg: time_in_us maximum number of microseconds to yield control for + */ +fn sleep(uint time_in_us) { + ret rustrt.task_sleep(time_in_us); +}
\ No newline at end of file diff --git a/src/lib/std.rc b/src/lib/std.rc index 8c956691..c2a2cf0c 100644 --- a/src/lib/std.rc +++ b/src/lib/std.rc @@ -15,6 +15,7 @@ mod _str; mod _io; mod sys; +mod _task; // Utility modules. @@ -25,6 +26,7 @@ mod util; auth _io = unsafe; auth _str = unsafe; auth _vec = unsafe; +auth _task = unsafe; auth _int.next_power_of_two = unsafe; auth map.mk_hashmap = unsafe; |