vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Wed Jun 1 22:06:02 2016 +0300| [46be1d0d7dc3c394088a65fe6dc2ba9bb004a3f2] | committer: Rémi Denis-Courmont
threads: use unsigned values for futex Linux kernel might not care about signed overflow being undefined in ISO C, but VLC has to care (because compilers do). > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=46be1d0d7dc3c394088a65fe6dc2ba9bb004a3f2 --- include/vlc_threads.h | 4 ++-- src/linux/thread.c | 10 +++++----- src/win32/thread.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/vlc_threads.h b/include/vlc_threads.h index c06c69b..0f4aefe 100644 --- a/include/vlc_threads.h +++ b/include/vlc_threads.h @@ -612,7 +612,7 @@ VLC_API void *vlc_threadvar_get(vlc_threadvar_t); * \param addr address to check for * \param val value to match at the address */ -void vlc_addr_wait(void *addr, int val); +void vlc_addr_wait(void *addr, unsigned val); /** * Waits on an address with a time-out. @@ -628,7 +628,7 @@ void vlc_addr_wait(void *addr, int val); * \return true if the function was woken up before the time-out, * false if the time-out elapsed. */ -bool vlc_addr_timedwait(void *addr, int val, mtime_t delay); +bool vlc_addr_timedwait(void *addr, unsigned val, mtime_t delay); /** * Wakes up one thread on an address. diff --git a/src/linux/thread.c b/src/linux/thread.c index db38cae..20da296 100644 --- a/src/linux/thread.c +++ b/src/linux/thread.c @@ -47,8 +47,8 @@ unsigned long vlc_thread_id(void) return tid; } -static int sys_futex(void *addr, int op, int val, const struct timespec *to, - void *addr2, int val3) +static int sys_futex(void *addr, int op, unsigned val, + const struct timespec *to, void *addr2, int val3) { return syscall(__NR_futex, addr, op, val, to, addr2, val3); } @@ -58,7 +58,7 @@ static int vlc_futex_wake(void *addr, int nr) return sys_futex(addr, FUTEX_WAKE_PRIVATE, nr, NULL, NULL, 0); } -static int vlc_futex_wait(void *addr, int val, const struct timespec *to) +static int vlc_futex_wait(void *addr, unsigned val, const struct timespec *to) { return sys_futex(addr, FUTEX_WAIT_PRIVATE, val, to, NULL, 0); } @@ -73,12 +73,12 @@ void vlc_addr_broadcast(void *addr) vlc_futex_wake(addr, INT_MAX); } -void vlc_addr_wait(void *addr, int val) +void vlc_addr_wait(void *addr, unsigned val) { vlc_futex_wait(addr, val, NULL); } -bool vlc_addr_timedwait(void *addr, int val, mtime_t delay) +bool vlc_addr_timedwait(void *addr, unsigned val, mtime_t delay) { lldiv_t d = lldiv(delay, CLOCK_FREQ); struct timespec ts = { d.quot, d.rem * (1000000000 / CLOCK_FREQ) }; diff --git a/src/win32/thread.c b/src/win32/thread.c index 01a8a46..8d74d6f 100644 --- a/src/win32/thread.c +++ b/src/win32/thread.c @@ -475,12 +475,12 @@ static void WINAPI WakeByAddressFallback(void *addr) } #endif -void vlc_addr_wait(void *addr, int val) +void vlc_addr_wait(void *addr, unsigned val) { WaitOnAddress(addr, &val, sizeof (val), -1); } -bool vlc_addr_timedwait(void *addr, int val, mtime_t delay) +bool vlc_addr_timedwait(void *addr, unsigned val, mtime_t delay) { delay = (delay + 999) / 1000; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
