diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-04-21 16:28:17 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-04-21 16:28:19 -0700 |
| commit | f9069baa70ea78117f2087fe6e359fb2ea0ae16a (patch) | |
| tree | 10aa6c6aae411de29cac226b91827a0f0d005348 /src/libcore/rt/sched | |
| parent | 4eff3130c589b5fb256c537e90272646fd8406ab (diff) | |
| download | rust-f9069baa70ea78117f2087fe6e359fb2ea0ae16a.tar.gz rust-f9069baa70ea78117f2087fe6e359fb2ea0ae16a.zip | |
core::rt: Add LocalServices for thread-local language services
Things like the GC heap and unwinding are desirable everywhere the language might be used, not just in tasks. All Rust code should have access to LocalServices.
Diffstat (limited to 'src/libcore/rt/sched')
| -rw-r--r-- | src/libcore/rt/sched/mod.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libcore/rt/sched/mod.rs b/src/libcore/rt/sched/mod.rs index 28946281628..30136e443ee 100644 --- a/src/libcore/rt/sched/mod.rs +++ b/src/libcore/rt/sched/mod.rs @@ -16,6 +16,7 @@ use super::work_queue::WorkQueue; use super::stack::{StackPool, StackSegment}; use super::rtio::{EventLoop, EventLoopObject}; use super::context::Context; +use super::local_services::LocalServices; use cell::Cell; #[cfg(test)] use super::uvio::UvEventLoop; @@ -38,7 +39,7 @@ pub struct Scheduler { /// Always valid when a task is executing, otherwise not priv saved_context: Context, /// The currently executing task - priv current_task: Option<~Task>, + current_task: Option<~Task>, /// An action performed after a context switch on behalf of the /// code running before the context switch priv cleanup_job: Option<CleanupJob> @@ -326,6 +327,8 @@ pub struct Task { /// These are always valid when the task is not running, unless /// the task is dead priv saved_context: Context, + /// The heap, GC, unwinding, local storage, logging + local_services: LocalServices } pub impl Task { @@ -337,6 +340,7 @@ pub impl Task { return Task { current_stack_segment: stack, saved_context: initial_context, + local_services: LocalServices::new() }; } |
