Kuon/sw/bsModules/bsKuon/bsKuonBgThread.c
static void BgThreadSyncTimedWait(long lMicroSecs)
{
  struct timeval  tvNow;
  struct timespec tsTimeout;
  long int        lSecs;

  // now
  // note: cannot find this function: clock_gettime(CLOCK_REALTIME, &tsTimeout)
  //       so use this one.
  gettimeofday(&tvNow, NULL);
  
  // future
  lMicroSecs  += tvNow.tv_usec;
  lSecs        = lMicroSecs / 1000000;
  lMicroSecs  -= (lSecs * 1000000);

  tsTimeout.tv_sec  = tvNow.tv_sec + lSecs;
  tsTimeout.tv_nsec = lMicroSecs * 1000;

  // wait with timeout
  pthread_mutex_lock(&BgCtlBlk.m_mutexSync);
  pthread_cond_timedwait(&BgCtlBlk.m_condSync,
                         &BgCtlBlk.m_mutexSync,
                         &tsTimeout);
  pthread_mutex_unlock(&BgCtlBlk.m_mutexSync);
}
/*!
 * \brief Wait until state change or timed out.
 *
 * \par Context:
 * background thread
 */
\brief Wait until state change or timed out.
\par Context:
background thread
\ brief Wait until state change or timed out . \ par Context : background thread
static void BgThreadSyncTimedWait(long lMicroSecs)
{
  struct timeval  tvNow;
  struct timespec tsTimeout;
  long int        lSecs;
  gettimeofday(&tvNow, NULL);
  lMicroSecs  += tvNow.tv_usec;
  lSecs        = lMicroSecs / 1000000;
  lMicroSecs  -= (lSecs * 1000000);
  tsTimeout.tv_sec  = tvNow.tv_sec + lSecs;
  tsTimeout.tv_nsec = lMicroSecs * 1000;
  pthread_mutex_lock(&BgCtlBlk.m_mutexSync);
  pthread_cond_timedwait(&BgCtlBlk.m_condSync,
                         &BgCtlBlk.m_mutexSync,
                         &tsTimeout);
  pthread_mutex_unlock(&BgCtlBlk.m_mutexSync);
}
static void BgThreadSyncTimedWait ( long lMicroSecs ) { struct timeval tvNow ; struct timespec tsTimeout ; long int lSecs ; gettimeofday ( & tvNow , NULL ) ; lMicroSecs += tvNow . tv_usec ; lSecs = lMicroSecs / 1000000 ; lMicroSecs -= ( lSecs * 1000000 ) ; tsTimeout . tv_sec = tvNow . tv_sec + lSecs ; tsTimeout . tv_nsec = lMicroSecs * 1000 ; pthread_mutex_lock ( & BgCtlBlk . m_mutexSync ) ; pthread_cond_timedwait ( & BgCtlBlk . m_condSync , & BgCtlBlk . m_mutexSync , & tsTimeout ) ; pthread_mutex_unlock ( & BgCtlBlk . m_mutexSync ) ; }
\brief Wait until state change or timed out.
\ brief Wait until state change or timed out .
// now // note: cannot find this function: clock_gettime(CLOCK_REALTIME, &tsTimeout) //       so use this one. // future // wait with timeout