Bug #3620
Compilation error when using Android NDK
0%
Description
Since this commit https://github.com/tvheadend/tvheadend/commit/6ff670943ce70a8f279e99306a1d49a78c6b6949 , there isn't possible to compile TVH for android because Android NDK doesn't implement pthread_condattr_setclock function
CC src/wrappers.o
src/wrappers.c: In function 'tvh_cond_init':
src/wrappers.c:229:3: error: implicit declaration of function 'pthread_condattr_setclock' [-Werror=implicit-function-declaration]
r = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
^
cc1: all warnings being treated as errors
make: *** [/home/ben/Desktop/android/tvheadend/build.linux/src/wrappers.o] Error
History
Updated by Jaroslav Kysela over 8 years ago
This functionality must be emulated. TVH switched from realtime clocks to monotonic clocks. The realtime clocks might change according the local time (DST) or synchronization (clock diffs). The tvheadend uses the monotonic clocks where appropriate (in other words - where the code must be clocked in a continuous way).
There are several methods to emulate pthread_condattr_setclock(&attr, CLOCK_MONOTONIC), if you have a monotonic clock source (which I believe android has). You may use evenfd() and poll() for example. Or busy-loop (a little bit tricky and ineffective). Note that tvh_cond_t structure might contain other members than pthread_cond_t .