about summary refs log tree commit diff
path: root/src/rt
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-06-21 16:52:07 -0700
committerBrian Anderson <banderson@mozilla.com>2013-06-21 16:52:07 -0700
commit95eb01957bf23922abdf083f677c6c2d6927713a (patch)
tree5c0fdfe373b011f5e72cf13f1547fc3aac67921d /src/rt
parent1b7c99655f300aa0b8ba216cd2029dc588c3ef88 (diff)
downloadrust-95eb01957bf23922abdf083f677c6c2d6927713a.tar.gz
rust-95eb01957bf23922abdf083f677c6c2d6927713a.zip
std: Make console log off/on controls work with newsched
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/rust_builtin.cpp12
-rw-r--r--src/rt/rust_log.cpp12
-rw-r--r--src/rt/rustrt.def.in1
3 files changed, 18 insertions, 7 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 86b8881b9f2..f0b68d4a156 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -591,12 +591,18 @@ rust_log_console_on() {
     log_console_on();
 }
 
-extern void log_console_off(rust_env *env);
+extern void log_console_off();
 
 extern "C" CDECL void
 rust_log_console_off() {
-    rust_task *task = rust_get_current_task();
-    log_console_off(task->kernel->env);
+    log_console_off();
+}
+
+extern bool should_log_console();
+
+extern "C" CDECL uintptr_t
+rust_should_log_console() {
+    return (uintptr_t)should_log_console();
 }
 
 extern "C" CDECL void
diff --git a/src/rt/rust_log.cpp b/src/rt/rust_log.cpp
index df24f569495..8179c53e96d 100644
--- a/src/rt/rust_log.cpp
+++ b/src/rt/rust_log.cpp
@@ -43,11 +43,15 @@ log_console_on() {
  * overridden by the environment.
  */
 void
-log_console_off(rust_env *env) {
+log_console_off() {
     scoped_lock with(_log_lock);
-    if (env->logspec == NULL) {
-        _log_to_console = false;
-    }
+    _log_to_console = false;
+}
+
+bool
+should_log_console() {
+    scoped_lock with(_log_lock);
+    return _log_to_console;
 }
 
 rust_log::rust_log(rust_sched_loop *sched_loop) :
diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in
index ca813c5d3ae..950662b91f8 100644
--- a/src/rt/rustrt.def.in
+++ b/src/rt/rustrt.def.in
@@ -37,6 +37,7 @@ rust_list_dir_wfd_size
 rust_list_dir_wfd_fp_buf
 rust_log_console_on
 rust_log_console_off
+rust_should_log_console
 rust_set_environ
 rust_unset_sigprocmask
 rust_sched_current_nonlazy_threads