… | |
… | |
49 | #include "rxvt.h" |
49 | #include "rxvt.h" |
50 | #include "rxvtperl.h" |
50 | #include "rxvtperl.h" |
51 | #include "version.h" |
51 | #include "version.h" |
52 | #include "command.h" |
52 | #include "command.h" |
53 | |
53 | |
54 | #if HAVE_SCHED_YIELD |
|
|
55 | #undef HAVE_SCHED_YIELD // disabled for the time being |
|
|
56 | //# include <sched.h> |
|
|
57 | #endif |
|
|
58 | |
|
|
59 | #ifdef KEYSYM_RESOURCE |
54 | #ifdef KEYSYM_RESOURCE |
60 | # include "keyboard.h" |
55 | # include "keyboard.h" |
61 | #endif |
56 | #endif |
62 | |
57 | |
63 | #include <csignal> |
58 | #include <csignal> |
|
|
59 | |
|
|
60 | #if LINUX_YIELD_HACK |
|
|
61 | # include <ctime> |
|
|
62 | #endif |
64 | |
63 | |
65 | /*----------------------------------------------------------------------*/ |
64 | /*----------------------------------------------------------------------*/ |
66 | |
65 | |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
66 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
68 | |
67 | |
… | |
… | |
1095 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1094 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1096 | } |
1095 | } |
1097 | } |
1096 | } |
1098 | #endif |
1097 | #endif |
1099 | |
1098 | |
1100 | #if HAVE_SCHED_YIELD |
1099 | #if LINUX_YIELD_HACK |
1101 | static struct event_handler |
1100 | static struct event_handler |
1102 | { |
1101 | { |
1103 | check_watcher cw_yield; |
1102 | check_watcher yield_ev; |
1104 | |
1103 | |
1105 | void yield (check_watcher &w) |
1104 | void yield_cb (check_watcher &w) |
1106 | { |
1105 | { |
1107 | sched_yield (); |
1106 | // this should really be sched_yield(), but the linux guys thought |
|
|
1107 | // that giving a process calling sched_yield () less cpu time than |
|
|
1108 | // ones with high nice levels. |
|
|
1109 | |
|
|
1110 | struct timespec ts = { 0, 0 }; |
|
|
1111 | nanosleep (&ts, 0); |
|
|
1112 | |
1108 | w.stop (); |
1113 | w.stop (); |
1109 | } |
1114 | } |
1110 | |
1115 | |
1111 | event_handler () |
1116 | event_handler () |
1112 | : cw_yield (this, &event_handler::yield) |
1117 | : yield_ev (this, &event_handler::yield_cb) |
1113 | { |
1118 | { |
1114 | } |
1119 | } |
1115 | } event_handler; |
1120 | } event_handler; |
1116 | #endif |
1121 | #endif |
1117 | |
1122 | |
… | |
… | |
1137 | cmdbuf_endp += r; |
1142 | cmdbuf_endp += r; |
1138 | return true; |
1143 | return true; |
1139 | } |
1144 | } |
1140 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1145 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1141 | { |
1146 | { |
1142 | #if HAVE_SCHED_YIELD |
1147 | #if LINUX_YIELD_HACK |
1143 | if (display->is_local) |
1148 | if (display->is_local) |
1144 | event_handler.cw_yield.start (); |
1149 | event_handler.yield_ev.start (); |
1145 | #endif |
1150 | #endif |
1146 | } |
1151 | } |
1147 | else |
1152 | else |
1148 | { |
1153 | { |
1149 | pty_ev.stop (); |
1154 | pty_ev.stop (); |