File tree Expand file tree Collapse file tree 3 files changed +20
-15
lines changed Expand file tree Collapse file tree 3 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -85,16 +85,6 @@ pub fn log_type<T>(level: u32, object: &T) {
8585fn newsched_log_str ( msg : ~str ) {
8686 use rt:: task:: Task ;
8787 use rt:: local:: Local ;
88- use str:: StrSlice ;
89- use container:: Container ;
90-
91- // Truncate the string
92- let buf_bytes = 256 ;
93- let msg = if msg. len ( ) > buf_bytes {
94- msg. slice ( 0 , buf_bytes) + "[...]"
95- } else {
96- msg
97- } ;
9888
9989 unsafe {
10090 match Local :: try_unsafe_borrow :: < Task > ( ) {
Original file line number Diff line number Diff line change 1010
1111use either:: * ;
1212use libc;
13+ use str:: StrSlice ;
1314
1415pub trait Logger {
1516 fn log ( & mut self , msg : Either < ~str , & ' static str > ) ;
@@ -35,10 +36,22 @@ impl Logger for StdErrLogger {
3536 s
3637 }
3738 } ;
38- let dbg = :: libc:: STDERR_FILENO as :: io:: fd_t ;
39- dbg. write_str ( s) ;
40- dbg. write_str ( "\n " ) ;
41- dbg. flush ( ) ;
39+
40+ // Truncate the string
41+ let buf_bytes = 256 ;
42+ if s. len ( ) > buf_bytes {
43+ let s = s. slice ( 0 , buf_bytes) + "[...]" ;
44+ print ( s) ;
45+ } else {
46+ print ( s)
47+ } ;
48+
49+ fn print ( s : & str ) {
50+ let dbg = :: libc:: STDERR_FILENO as :: io:: fd_t ;
51+ dbg. write_str ( s) ;
52+ dbg. write_str ( "\n " ) ;
53+ dbg. flush ( ) ;
54+ }
4255 }
4356}
4457
Original file line number Diff line number Diff line change @@ -339,8 +339,8 @@ impl Scheduler {
339339 let mut this = self ;
340340 match this. message_queue . pop ( ) {
341341 Some ( PinnedTask ( task) ) => {
342- let mut task = task;
343342 this. event_loop . callback ( Scheduler :: run_sched_once) ;
343+ let mut task = task;
344344 task. give_home ( Sched ( this. make_handle ( ) ) ) ;
345345 this. resume_task_immediately ( task) ;
346346 return None ;
@@ -351,10 +351,12 @@ impl Scheduler {
351351 return this. sched_schedule_task ( task) ;
352352 }
353353 Some ( Wake ) => {
354+ this. event_loop . callback ( Scheduler :: run_sched_once) ;
354355 this. sleepy = false ;
355356 return Some ( this) ;
356357 }
357358 Some ( Shutdown ) => {
359+ this. event_loop . callback ( Scheduler :: run_sched_once) ;
358360 if this. sleepy {
359361 // There may be an outstanding handle on the
360362 // sleeper list. Pop them all to make sure that's
You can’t perform that action at this time.
0 commit comments