/** Provides the service routine for the DS polling thread. */
 private void task() {
   int safetyCounter = 0;
   while (m_thread_keepalive) {
     try {
       m_packetDataAvailableSem.takeForever();
       synchronized (this) {
         getData();
         m_enhancedIO.updateData();
         setData();
       }
       synchronized (m_dataSem) {
         m_dataSem.notifyAll();
       }
       if (++safetyCounter >= 5) {
         //               System.out.println("Checking safety");
         MotorSafetyHelper.checkMotors();
         safetyCounter = 0;
       }
     } catch (SemaphoreException ex) {
       //
     }
   }
 }