… | |
… | |
54 | #ifdef KEYSYM_RESOURCE |
54 | #ifdef KEYSYM_RESOURCE |
55 | # include "keyboard.h" |
55 | # include "keyboard.h" |
56 | #endif |
56 | #endif |
57 | |
57 | |
58 | #include <csignal> |
58 | #include <csignal> |
|
|
59 | |
|
|
60 | #if LINUX_YIELD_HACK |
|
|
61 | # include <ctime> |
|
|
62 | #endif |
59 | |
63 | |
60 | /*----------------------------------------------------------------------*/ |
64 | /*----------------------------------------------------------------------*/ |
61 | |
65 | |
62 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
66 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
63 | |
67 | |
… | |
… | |
1097 | { |
1101 | { |
1098 | check_watcher yield_ev; |
1102 | check_watcher yield_ev; |
1099 | |
1103 | |
1100 | void yield_cb (check_watcher &w) |
1104 | void yield_cb (check_watcher &w) |
1101 | { |
1105 | { |
1102 | usleep (0); |
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 | |
1103 | w.stop (); |
1113 | w.stop (); |
1104 | } |
1114 | } |
1105 | |
1115 | |
1106 | event_handler () |
1116 | event_handler () |
1107 | : yield_ev (this, &event_handler::yield_cb) |
1117 | : yield_ev (this, &event_handler::yield_cb) |