Author: cazfi Date: Tue Jan 24 08:24:34 2017 New Revision: 34884 URL: http://svn.gna.org/viewcvs/freeciv?rev=34884&view=rev Log: Updated included tinycthread to latest upstream commit.
See patch #8084 Modified: branches/S3_0/dependencies/tinycthread/Version branches/S3_0/dependencies/tinycthread/tinycthread.c branches/S3_0/dependencies/tinycthread/tinycthread.h Modified: branches/S3_0/dependencies/tinycthread/Version URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/dependencies/tinycthread/Version?rev=34884&r1=34883&r2=34884&view=diff ============================================================================== --- branches/S3_0/dependencies/tinycthread/Version (original) +++ branches/S3_0/dependencies/tinycthread/Version Tue Jan 24 08:24:34 2017 @@ -1,6 +1,6 @@ Source here are from tinycthread development version from https://github.com/tinycthread/tinycthread -commit ffbb00b2c0d2daa501ab42d6346bd8717c2d6eed -Sat Nov 14 19:35:48 2015 -0800 +commit 6957fc8383d6c7db25b60b8c849b29caab1caaee +Fri Sep 30 12:47:32 2016 -0400 Only files needed by freeciv have been included here. Modified: branches/S3_0/dependencies/tinycthread/tinycthread.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/dependencies/tinycthread/tinycthread.c?rev=34884&r1=34883&r2=34884&view=diff ============================================================================== --- branches/S3_0/dependencies/tinycthread/tinycthread.c (original) +++ branches/S3_0/dependencies/tinycthread/tinycthread.c Tue Jan 24 08:24:34 2017 @@ -1,6 +1,6 @@ /* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; -*- Copyright (c) 2012 Marcus Geelnard -Copyright (c) 2013-2014 Evan Nemerson +Copyright (c) 2013-2016 Evan Nemerson This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -384,7 +384,8 @@ #if defined(_TTHREAD_WIN32_) static int _cnd_timedwait_win32(cnd_t *cond, mtx_t *mtx, DWORD timeout) { - int result, lastWaiter; + DWORD result; + int lastWaiter; /* Increment number of waiters */ EnterCriticalSection(&cond->mWaitersCountLock); @@ -404,7 +405,7 @@ mtx_lock(mtx); return thrd_timedout; } - else if (result == (int)WAIT_FAILED) + else if (result == WAIT_FAILED) { /* The mutex is locked again before the function returns, even if an error occurred */ mtx_lock(mtx); @@ -641,7 +642,7 @@ int thrd_equal(thrd_t thr0, thrd_t thr1) { #if defined(_TTHREAD_WIN32_) - return thr0 == thr1; + return GetThreadId(thr0) == GetThreadId(thr1); #else return pthread_equal(thr0, thr1); #endif @@ -655,7 +656,7 @@ _tinycthread_tss_cleanup(); } - ExitThread(res); + ExitThread((DWORD)res); #else pthread_exit((void*)(intptr_t)res); #endif @@ -674,7 +675,7 @@ { if (GetExitCodeThread(thr, &dwRes) != 0) { - *res = dwRes; + *res = (int) dwRes; } else { @@ -699,7 +700,14 @@ int thrd_sleep(const struct timespec *duration, struct timespec *remaining) { #if !defined(_TTHREAD_WIN32_) - return nanosleep(duration, remaining); + int res = nanosleep(duration, remaining); + if (res == 0) { + return 0; + } else if (errno == EINTR) { + return -1; + } else { + return -2; + } #else struct timespec start; DWORD t; @@ -713,20 +721,20 @@ if (t == 0) { return 0; - } else if (remaining != NULL) { - timespec_get(remaining, TIME_UTC); - remaining->tv_sec -= start.tv_sec; - remaining->tv_nsec -= start.tv_nsec; - if (remaining->tv_nsec < 0) - { - remaining->tv_nsec += 1000000000; - remaining->tv_sec -= 1; - } } else { - return -1; - } - - return 0; + if (remaining != NULL) { + timespec_get(remaining, TIME_UTC); + remaining->tv_sec -= start.tv_sec; + remaining->tv_nsec -= start.tv_nsec; + if (remaining->tv_nsec < 0) + { + remaining->tv_nsec += 1000000000; + remaining->tv_sec -= 1; + } + } + + return (t == WAIT_IO_COMPLETION) ? -1 : -2; + } #endif } Modified: branches/S3_0/dependencies/tinycthread/tinycthread.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/dependencies/tinycthread/tinycthread.h?rev=34884&r1=34883&r2=34884&view=diff ============================================================================== --- branches/S3_0/dependencies/tinycthread/tinycthread.h (original) +++ branches/S3_0/dependencies/tinycthread/tinycthread.h Tue Jan 24 08:24:34 2017 @@ -1,6 +1,6 @@ /* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; -*- Copyright (c) 2012 Marcus Geelnard -Copyright (c) 2013-2014 Evan Nemerson +Copyright (c) 2013-2016 Evan Nemerson This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -76,6 +76,7 @@ #undef _XOPEN_SOURCE #define _XOPEN_SOURCE 500 #endif + #define _XPG6 #endif /* Generic includes */ @@ -220,7 +221,14 @@ */ int mtx_lock(mtx_t *mtx); -/** NOT YET IMPLEMENTED. +/** Lock the given mutex, or block until a specific point in time. +* Blocks until either the given mutex can be locked, or the specified TIME_UTC +* based time. +* @param mtx A mutex object. +* @param ts A UTC based calendar time +* @return @ref The mtx_timedlock function returns thrd_success on success, or +* thrd_timedout if the time specified was reached without acquiring the +* requested resource, or thrd_error if the request could not be honored. */ int mtx_timedlock(mtx_t *mtx, const struct timespec *ts); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits