mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Fixed uses of relative time for cnd_timedwait.
This commit is contained in:
parent
89627e4cd0
commit
fe05515f43
@ -28,6 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#define GLFW_INCLUDE_GLU
|
||||
#include <GLFW/glfw3.h>
|
||||
@ -453,7 +454,9 @@ static void draw_particles(GLFWwindow* window, double t, float dt)
|
||||
while (!glfwWindowShouldClose(window) &&
|
||||
thread_sync.p_frame <= thread_sync.d_frame)
|
||||
{
|
||||
struct timespec ts = { 0, 100000000 };
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_nsec += 100000000;
|
||||
cnd_timedwait(&thread_sync.p_done, &thread_sync.particles_lock, &ts);
|
||||
}
|
||||
|
||||
@ -897,7 +900,9 @@ static int physics_thread_main(void* arg)
|
||||
while (!glfwWindowShouldClose(window) &&
|
||||
thread_sync.p_frame > thread_sync.d_frame)
|
||||
{
|
||||
struct timespec ts = { 0, 100000000 };
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_nsec += 100000000;
|
||||
cnd_timedwait(&thread_sync.d_done, &thread_sync.particles_lock, &ts);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user