vlc | branch: master | Steve Lhomme <[email protected]> | Wed Jul 4 11:15:47 2018 +0200| [d418aafd8f7fe2b04053fbd58e4c368c43952db5] | committer: Steve Lhomme
linux:thread: separate the code for mtime_to_ts() This function is defined multiple times. That may be something we want to share throughout the code. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d418aafd8f7fe2b04053fbd58e4c368c43952db5 --- src/linux/thread.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/linux/thread.c b/src/linux/thread.c index 1d176b54f5..15e8a08439 100644 --- a/src/linux/thread.c +++ b/src/linux/thread.c @@ -78,10 +78,17 @@ void vlc_addr_wait(void *addr, unsigned val) vlc_futex_wait(addr, val, NULL); } -bool vlc_addr_timedwait(void *addr, unsigned val, vlc_tick_t delay) +static struct timespec mtime_to_ts (vlc_tick_t date) { - lldiv_t d = lldiv(delay, CLOCK_FREQ); + lldiv_t d = lldiv (date, CLOCK_FREQ); struct timespec ts = { d.quot, NS_FROM_VLC_TICK( d.rem ) }; + return ts; +} + +bool vlc_addr_timedwait(void *addr, unsigned val, vlc_tick_t delay) +{ + struct timespec ts = mtime_to_ts(delay); + return (vlc_futex_wait(addr, val, &ts) == 0 || errno != ETIMEDOUT); } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
