actually acquire the frame lock that i should have been doing all this time... *facepalm*

This commit is contained in:
insofaras 2016-03-24 03:22:04 +00:00
parent 1f415d13fc
commit 289e92bf28
1 changed files with 6 additions and 0 deletions

View File

@ -1935,6 +1935,8 @@ main(int argc, char **argv)
exchange_vars.thread.queues[BACKGROUND_THREADS].semaphore = exchange_vars.thread.queues[BACKGROUND_THREADS].semaphore =
LinuxSemToHandle(&linuxvars.thread_semaphores[BACKGROUND_THREADS]); LinuxSemToHandle(&linuxvars.thread_semaphores[BACKGROUND_THREADS]);
system_acquire_lock(FRAME_LOCK);
for(i32 i = 0; i < linuxvars.groups[BACKGROUND_THREADS].count; ++i){ for(i32 i = 0; i < linuxvars.groups[BACKGROUND_THREADS].count; ++i){
Thread_Context *thread = linuxvars.groups[BACKGROUND_THREADS].threads + i; Thread_Context *thread = linuxvars.groups[BACKGROUND_THREADS].threads + i;
thread->id = i + 1; thread->id = i + 1;
@ -2514,11 +2516,15 @@ main(int argc, char **argv)
LinuxRedrawTarget(); LinuxRedrawTarget();
} }
system_release_lock(FRAME_LOCK);
u64 time_diff = system_time() - start_time; u64 time_diff = system_time() - start_time;
if(time_diff < frame_useconds){ if(time_diff < frame_useconds){
usleep(frame_useconds - time_diff); usleep(frame_useconds - time_diff);
} }
system_acquire_lock(FRAME_LOCK);
if(result.mouse_cursor_type != linuxvars.cursor){ if(result.mouse_cursor_type != linuxvars.cursor){
Cursor c = xcursors[result.mouse_cursor_type]; Cursor c = xcursors[result.mouse_cursor_type];
XDefineCursor(linuxvars.XDisplay, linuxvars.XWindow, c); XDefineCursor(linuxvars.XDisplay, linuxvars.XWindow, c);