Fixed timeout in Linux condition variable implementation
authorSam Lantinga <slouken@libsdl.org>
Fri, 23 Nov 2001 17:11:05 +0000
changeset 244dc660aee7d7d
parent 243 cf4944faad96
child 245 ab781a7dd82f
Fixed timeout in Linux condition variable implementation
src/thread/linux/SDL_syscond.c
     1.1 --- a/src/thread/linux/SDL_syscond.c	Thu Nov 22 06:34:25 2001 +0000
     1.2 +++ b/src/thread/linux/SDL_syscond.c	Fri Nov 23 17:11:05 2001 +0000
     1.3 @@ -137,10 +137,10 @@
     1.4  	gettimeofday(&delta, NULL);
     1.5  
     1.6  	abstime.tv_sec = delta.tv_sec + (ms/1000);
     1.7 -	abstime.tv_nsec = (delta.tv_usec+(ms%1000)) * 1000;
     1.8 -        if ( abstime.tv_nsec > 1000000 ) {
     1.9 +	abstime.tv_nsec = (delta.tv_usec + (ms%1000) * 1000) * 1000;
    1.10 +        if ( abstime.tv_nsec > 1000000000 ) {
    1.11            abstime.tv_sec += 1;
    1.12 -          abstime.tv_nsec -= 1000000;
    1.13 +          abstime.tv_nsec -= 1000000000;
    1.14          }
    1.15  
    1.16    tryagain: