botsense/bsProxy/bsProxyThread.c
BsProxyThReq_T *ThDequeue(BsProxyThCtl_T *pThCtl)
{
  BsProxyThReq_T  *pThReq;

  // lock thread and queue
  ThSyncLock(pThCtl);

  //
  // Block waiting for queued request or state change event.
  //
  while( (pThCtl->m_eState == BsProxyThStateRunning) &&
         (DListVoidCount(pThCtl->m_queue) == 0) )
  {
    // Release mutex, block on conditional variable, auto-lock mutex on return.
    ThSyncWait(pThCtl);
  }

  if( pThCtl->m_eState == BsProxyThStateRunning )
  {
    pThReq = (BsProxyThReq_T *)DListVoidDequeue(pThCtl->m_queue);
  }
  else
  {
    pThReq = NULL;
  }

  // unlock thread and queue
  ThSyncUnlock(pThCtl);

  return pThReq;
}
/*!
 * \brief Dequeue a request for the given service thread.
 *
 * The service thread will block if no queued request is present.
 *
 * \par Execution Context:
 * Service thread.
 *
 * \return On success, returns removed request at the front of the queue.\n
 * On failure, NULL is returned.
 */
\brief Dequeue a request for the given service thread.
The service thread will block if no queued request is present.

\par Execution Context:
Service thread.

\return On success, returns removed request at the front of the queue.\n
On failure, NULL is returned.
\ brief Dequeue a request for the given service thread . The service thread will block if no queued request is present . \ par Execution Context : Service thread . \ return On success returns removed request at the front of the queue . \ n On failure NULL is returned .
BsProxyThReq_T *ThDequeue(BsProxyThCtl_T *pThCtl)
{
  BsProxyThReq_T  *pThReq;
  ThSyncLock(pThCtl);
   Block waiting for queued request or state change event.
  while( (pThCtl->m_eState == BsProxyThStateRunning) &&
         (DListVoidCount(pThCtl->m_queue) == 0) )
  {
     Release mutex, block on conditional variable, auto-lock mutex on return.
    ThSyncWait(pThCtl);
  }
  if( pThCtl->m_eState == BsProxyThStateRunning )
  {
    pThReq = (BsProxyThReq_T *)DListVoidDequeue(pThCtl->m_queue);
  }
  else
  {
    pThReq = NULL;
  }
   unlock thread and queue
  ThSyncUnlock(pThCtl);
  return pThReq;
}
BsProxyThReq_T * ThDequeue ( BsProxyThCtl_T * pThCtl ) { BsProxyThReq_T * pThReq ; ThSyncLock ( pThCtl ) ; while ( ( pThCtl -> m_eState == BsProxyThStateRunning ) && ( DListVoidCount ( pThCtl -> m_queue ) == 0 ) ) { ThSyncWait ( pThCtl ) ; } if ( pThCtl -> m_eState == BsProxyThStateRunning ) { pThReq = ( BsProxyThReq_T * ) DListVoidDequeue ( pThCtl -> m_queue ) ; } else { pThReq = NULL ; } ThSyncUnlock ( pThCtl ) ; return pThReq ; }
\brief Dequeue a request for the given service thread.
\ brief Dequeue a request for the given service thread .
// lock thread and queue // // Block waiting for queued request or state change event. // // Release mutex, block on conditional variable, auto-lock mutex on return. // unlock thread and queue