move over to clock_realtime from clock_monotonic. Seems to work.

This commit is contained in:
Mike Brady
2021-04-30 10:12:59 +01:00
parent 3a02b79a62
commit b3cec5c690
4 changed files with 3 additions and 31 deletions
-11
View File
@@ -153,18 +153,7 @@ void *activity_monitor_thread_code(void *arg) {
if (rc)
die("activity_monitor: error %d initialising activity_monitor_mutex.", rc);
// set the flowcontrol condition variable to wait on a monotonic clock
#ifdef COMPILE_FOR_LINUX_AND_FREEBSD_AND_CYGWIN_AND_OPENBSD
pthread_condattr_t attr;
pthread_condattr_init(&attr);
pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); // can't do this in OS X, and don't need it.
rc = pthread_cond_init(&activity_monitor_cv, &attr);
pthread_condattr_destroy(&attr);
#endif
#ifdef COMPILE_FOR_OSX
rc = pthread_cond_init(&activity_monitor_cv, NULL);
#endif
if (rc)
die("activity_monitor: error %d initialising activity_monitor_cv.");
pthread_cleanup_push(activity_thread_cleanup_handler, arg);
+2 -1
View File
@@ -1250,7 +1250,8 @@ uint64_t get_absolute_time_in_ns() {
#ifdef COMPILE_FOR_LINUX_AND_FREEBSD_AND_CYGWIN_AND_OPENBSD
struct timespec tn;
// can't use CLOCK_MONOTONIC_RAW as it's not implemented in OpenWrt
clock_gettime(CLOCK_MONOTONIC, &tn);
// CLOCK_REALTIME because PTP uses it.
clock_gettime(CLOCK_REALTIME, &tn);
uint64_t tnnsec = tn.tv_sec;
tnnsec = tnnsec * 1000000000;
uint64_t tnjnsec = tn.tv_nsec;
+1 -10
View File
@@ -936,18 +936,9 @@ void *dacp_monitor_thread_code(__attribute__((unused)) void *na) {
void dacp_monitor_start() {
int rc;
#ifdef COMPILE_FOR_LINUX_AND_FREEBSD_AND_CYGWIN_AND_OPENBSD
pthread_condattr_t attr;
pthread_condattr_init(&attr);
pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); // can't do this in OS X, and don't need it.
rc = pthread_cond_init(&dacp_server_information_cv, &attr);
rc = pthread_cond_init(&dacp_server_information_cv, NULL);
if (rc)
debug(1, "Error initialising the DACP Server Information Condition Variable");
pthread_condattr_destroy(&attr);
#endif
#ifdef COMPILE_FOR_OSX
rc = pthread_cond_init(&dacp_server_information_cv, NULL);
#endif
pthread_mutexattr_t mta;
-9
View File
@@ -2662,16 +2662,7 @@ static void *rtsp_conversation_thread_func(void *pconn) {
rc = pthread_mutex_init(&conn->ab_mutex, NULL);
if (rc)
die("Connection %d: error %d initialising ab_mutex.", conn->connection_number, rc);
// set the flowcontrol condition variable to wait on a monotonic clock
#ifdef COMPILE_FOR_LINUX_AND_FREEBSD_AND_CYGWIN_AND_OPENBSD
pthread_condattr_t attr;
pthread_condattr_init(&attr);
pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); // can't do this in OS X, and don't need it.
rc = pthread_cond_init(&conn->flowcontrol, &attr);
#endif
#ifdef COMPILE_FOR_OSX
rc = pthread_cond_init(&conn->flowcontrol, NULL);
#endif
if (rc)
die("Connection %d: error %d initialising flow control condition variable.",
conn->connection_number, rc);