1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 02:38:52 -05:00

Fix particles stutter caused by malformed timeout

Closes #836.
This commit is contained in:
Camilla Berglund 2016-08-22 15:52:11 +02:00
parent 9cd0c101f0
commit 1592b40e25

View File

@ -457,7 +457,9 @@ static void draw_particles(GLFWwindow* window, double t, float dt)
{ {
struct timespec ts; struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_nsec += 100000000; ts.tv_nsec += 100 * 1000 * 1000;
ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000);
ts.tv_nsec %= 1000 * 1000 * 1000;
cnd_timedwait(&thread_sync.p_done, &thread_sync.particles_lock, &ts); cnd_timedwait(&thread_sync.p_done, &thread_sync.particles_lock, &ts);
} }
@ -908,7 +910,9 @@ static int physics_thread_main(void* arg)
{ {
struct timespec ts; struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_nsec += 100000000; ts.tv_nsec += 100 * 1000 * 1000;
ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000);
ts.tv_nsec %= 1000 * 1000 * 1000;
cnd_timedwait(&thread_sync.d_done, &thread_sync.particles_lock, &ts); cnd_timedwait(&thread_sync.d_done, &thread_sync.particles_lock, &ts);
} }