Merge branch 'master' into cairocanvas
[ardour.git] / libs / ardour / mtc_slave.cc
index e9071af61917690bc7d86d4eb25205c2ebdb2f24..1a1c5f2becfe8a5a510b5442783b98360c1f5ea4 100644 (file)
 */
 #include <iostream>
 #include <errno.h>
-#include <poll.h>
 #include <sys/types.h>
 #include <unistd.h>
 
 #include "pbd/error.h"
+#include "pbd/pthread_utils.h"
 
 #include "ardour/audioengine.h"
 #include "ardour/debug.h"
@@ -32,6 +32,8 @@
 #include "ardour/session.h"
 #include "ardour/slave.h"
 
+#include <glibmm/timer.h>
+
 #include "i18n.h"
 
 using namespace std;
@@ -236,7 +238,7 @@ MTC_Slave::read_current (SafeTime *st) const
        do {
                if (tries == 10) {
                        error << _("MTC Slave: atomic read of current time failed, sleeping!") << endmsg;
-                       usleep (20);
+                       Glib::usleep (20);
                        tries = 0;
                }
                *st = current;
@@ -299,7 +301,7 @@ MTC_Slave::update_mtc_qtr (Parser& /*p*/, int which_qtr, framepos_t now)
  * when a full TC has been received
  * OR on locate */
 void
-MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now)
+MTC_Slave::update_mtc_time (const MIDI::byte *msg, bool was_full, framepos_t now)
 {
        busy_guard1++;
 
@@ -307,8 +309,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now)
           to use a timestamp indicating when this MTC time was received. example: when we received
           a locate command via MMC.
        */
-
-       DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC::update_mtc_time - TID:%1\n", ::pthread_self()));
+       DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC::update_mtc_time - TID:%1\n", pthread_name()));
        TimecodeFormat tc_format;
        bool reset_tc = true;
 
@@ -488,7 +489,7 @@ MTC_Slave::update_mtc_status (MIDI::MTC_Status status)
        /* XXX !!! thread safety ... called from MIDI I/O context
         * on locate (via ::update_mtc_time())
         */
-       DEBUG_TRACE (DEBUG::MTC, string_compose("MTC_Slave::update_mtc_status - TID:%1\n", ::pthread_self()));
+       DEBUG_TRACE (DEBUG::MTC, string_compose("MTC_Slave::update_mtc_status - TID:%1\n", pthread_name()));
        return; // why was this fn needed anyway ? it just messes up things -> use reset.
        busy_guard1++;