From ff06c785b0b4b88623b2f74d9b96029e968f14e4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 23 Nov 2001 17:11:05 +0000 Subject: [PATCH] Fixed timeout in Linux condition variable implementation --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40245 --- src/thread/linux/SDL_syscond.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/thread/linux/SDL_syscond.c b/src/thread/linux/SDL_syscond.c index a928695ef..36efa0b0a 100644 --- a/src/thread/linux/SDL_syscond.c +++ b/src/thread/linux/SDL_syscond.c @@ -137,10 +137,10 @@ int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms) gettimeofday(&delta, NULL); abstime.tv_sec = delta.tv_sec + (ms/1000); - abstime.tv_nsec = (delta.tv_usec+(ms%1000)) * 1000; - if ( abstime.tv_nsec > 1000000 ) { + abstime.tv_nsec = (delta.tv_usec + (ms%1000) * 1000) * 1000; + if ( abstime.tv_nsec > 1000000000 ) { abstime.tv_sec += 1; - abstime.tv_nsec -= 1000000; + abstime.tv_nsec -= 1000000000; } tryagain: