File tree 3 files changed +20
-15
lines changed
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) {
85
85
fn newsched_log_str ( msg : ~str ) {
86
86
use rt:: task:: Task ;
87
87
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
- } ;
98
88
99
89
unsafe {
100
90
match Local :: try_unsafe_borrow :: < Task > ( ) {
Original file line number Diff line number Diff line change 10
10
11
11
use either:: * ;
12
12
use libc;
13
+ use str:: StrSlice ;
13
14
14
15
pub trait Logger {
15
16
fn log ( & mut self , msg : Either < ~str , & ' static str > ) ;
@@ -35,10 +36,22 @@ impl Logger for StdErrLogger {
35
36
s
36
37
}
37
38
} ;
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
+ }
42
55
}
43
56
}
44
57
Original file line number Diff line number Diff line change @@ -339,8 +339,8 @@ impl Scheduler {
339
339
let mut this = self ;
340
340
match this. message_queue . pop ( ) {
341
341
Some ( PinnedTask ( task) ) => {
342
- let mut task = task;
343
342
this. event_loop . callback ( Scheduler :: run_sched_once) ;
343
+ let mut task = task;
344
344
task. give_home ( Sched ( this. make_handle ( ) ) ) ;
345
345
this. resume_task_immediately ( task) ;
346
346
return None ;
@@ -351,10 +351,12 @@ impl Scheduler {
351
351
return this. sched_schedule_task ( task) ;
352
352
}
353
353
Some ( Wake ) => {
354
+ this. event_loop . callback ( Scheduler :: run_sched_once) ;
354
355
this. sleepy = false ;
355
356
return Some ( this) ;
356
357
}
357
358
Some ( Shutdown ) => {
359
+ this. event_loop . callback ( Scheduler :: run_sched_once) ;
358
360
if this. sleepy {
359
361
// There may be an outstanding handle on the
360
362
// sleeper list. Pop them all to make sure that's
You can’t perform that action at this time.
0 commit comments