65 |
|
static int16 mouse_wheel_lines; |
66 |
|
static bool redraw_thread_active = false; // Flag: Redraw thread installed |
67 |
|
static pthread_attr_t redraw_thread_attr; // Redraw thread attributes |
68 |
+ |
static volatile bool redraw_thread_cancel; // Flag: Cancel Redraw thread |
69 |
|
static pthread_t redraw_thread; // Redraw thread |
70 |
|
|
71 |
|
static bool local_X11; // Flag: X server running on local machine? |
1194 |
|
// Start periodic thread |
1195 |
|
XSync(x_display, false); |
1196 |
|
Set_pthread_attr(&redraw_thread_attr, 0); |
1197 |
+ |
redraw_thread_cancel = false; |
1198 |
|
redraw_thread_active = (pthread_create(&redraw_thread, &redraw_thread_attr, redraw_func, NULL) == 0); |
1199 |
|
D(bug("Redraw thread installed (%ld)\n", redraw_thread)); |
1200 |
|
return true; |
1209 |
|
{ |
1210 |
|
// Stop redraw thread |
1211 |
|
if (redraw_thread_active) { |
1212 |
+ |
redraw_thread_cancel = true; |
1213 |
|
pthread_cancel(redraw_thread); |
1214 |
|
pthread_join(redraw_thread, NULL); |
1215 |
|
redraw_thread_active = false; |
2298 |
|
int64 ticks = 0; |
2299 |
|
uint64 next = GetTicks_usec() + VIDEO_REFRESH_DELAY; |
2300 |
|
|
2301 |
< |
for (;;) { |
2301 |
> |
while (!redraw_thread_cancel) { |
2302 |
|
|
2303 |
|
// Pause if requested (during video mode switches) |
2304 |
|
while (thread_stop_req) |