ruby-changes:15986
From: usa <ko1@a...>
Date: Fri, 21 May 2010 01:13:52 +0900 (JST)
Subject: [ruby-changes:15986] Ruby:r27930 (trunk): * thread.c (subtract_tv): if the rest is zero, should finish waiting
usa 2010-05-21 01:13:35 +0900 (Fri, 21 May 2010) New Revision: 27930 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27930 Log: * thread.c (subtract_tv): if the rest is zero, should finish waiting immediately. * win32/win32.c (subtract): ditto. based on a patch from Roger Pack in [ruby-core:27957]. Modified files: trunk/ChangeLog trunk/thread.c trunk/win32/win32.c Index: ChangeLog =================================================================== --- ChangeLog (revision 27929) +++ ChangeLog (revision 27930) @@ -1,3 +1,11 @@ +Fri May 21 01:06:05 2010 NAKAMURA Usaku <usa@r...> + + * thread.c (subtract_tv): if the rest is zero, should finish waiting + immediately. + + * win32/win32.c (subtract): ditto. + based on a patch from Roger Pack in [ruby-core:27957]. + Thu May 20 22:49:04 2010 Yusuke Endoh <mame@t...> * re.c (rb_reg_s_union_m): update rdoc. [ruby-dev:41354] Index: thread.c =================================================================== --- thread.c (revision 27929) +++ thread.c (revision 27930) @@ -2411,6 +2411,9 @@ static int subtract_tv(struct timeval *rest, const struct timeval *wait) { + if (rest->tv_sec < wait->tv_sec) { + return 0; + } while (rest->tv_usec < wait->tv_usec) { if (rest->tv_sec <= wait->tv_sec) { return 0; @@ -2420,7 +2423,7 @@ } rest->tv_sec -= wait->tv_sec; rest->tv_usec -= wait->tv_usec; - return 1; + return rest->tv_sec != 0 || rest->tv_usec != 0; } #endif Index: win32/win32.c =================================================================== --- win32/win32.c (revision 27929) +++ win32/win32.c (revision 27930) @@ -2471,7 +2471,7 @@ } rest->tv_sec -= wait->tv_sec; rest->tv_usec -= wait->tv_usec; - return 1; + return rest->tv_sec != 0 || rest->tv_usec != 0; } static inline int -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/