botsense/bsProxy/bsProxyThread.c
int ThQueue(BsProxyThCtl_T     *pThCtl,
            BsProxyClientHnd_T  hndClient,
            BsVConnHnd_T        hndVConn,
            BsTid_T             uTid,
            BsMsgId_T           uMsgId,
            byte_t              bufReq[],
            size_t              uReqLen)
{
  BsProxyThReq_T *pThReq;
  int             rc;

  // lock thread and queue
  ThSyncLock(pThCtl);

  //
  // Queue request on thread's message queue.
  //
  if( DListVoidCount(pThCtl->m_queue) < BSPROXY_TH_MAX_QUEUE_SIZE )
  {
    pThReq = ThReqNew(hndClient, hndVConn, uTid, uMsgId, bufReq, uReqLen);
    DListVoidQueue(pThCtl->m_queue, pThReq);
    ThSyncSignal(pThCtl);
    LOGDIAG3("%s: Service Thread \"%s\": queue depth=%u.",
      ServerHasName(), pThCtl->m_sDevUri, DListVoidCount(pThCtl->m_queue)); 
    rc = BS_OK;
  }
  else
  {
    rc = -BS_ECODE_NO_RSRC;
    BSPROXY_TH_LOG_ERROR(pThCtl->m_sDevUri, rc, "Queue overflow.");
  }

  // unlock thread and queue
  ThSyncUnlock(pThCtl);

  return rc;
}
/*!
 * \brief Queue a request for the given service thread.
 *
 * \par Execution Context:
 * Calling thread.
 *
 * \param pThCtl    Service thread control block.
 * \param hndClient Client handle.
 * \param hndVConn  Virtual connection handle.
 * \param uTid      Request-Response transaction id.
 * \param uMsgId    Request message id.
 * \param bufReq    Allocated packed request message body.
 * \param uReqLen   Length of request in buffer (number of bytes).
 *
 * \copydoc doc_return_std
 */
\brief Queue a request for the given service thread.
\par Execution Context:
Calling thread.

\param pThCtl    Service thread control block.
\param hndClient Client handle.
\param hndVConn  Virtual connection handle.
\param uTid      Request-Response transaction id.
\param uMsgId    Request message id.
\param bufReq    Allocated packed request message body.
\param uReqLen   Length of request in buffer (number of bytes).


\ brief Queue a request for the given service thread . \ par Execution Context : Calling thread . \ param pThCtl Service thread control block . \ param hndClient Client handle . \ param hndVConn Virtual connection handle . \ param uTid Request - Response transaction id . \ param uMsgId Request message id . \ param bufReq Allocated packed request message body . \ param uReqLen Length of request in buffer ( number of bytes ) .
int ThQueue(BsProxyThCtl_T     *pThCtl,
            BsProxyClientHnd_T  hndClient,
            BsVConnHnd_T        hndVConn,
            BsTid_T             uTid,
            BsMsgId_T           uMsgId,
            byte_t              bufReq[],
            size_t              uReqLen)
{
  BsProxyThReq_T *pThReq;
  int             rc;
  ThSyncLock(pThCtl);
   Queue request on thread's message queue.
  if( DListVoidCount(pThCtl->m_queue) < BSPROXY_TH_MAX_QUEUE_SIZE )
  {
    pThReq = ThReqNew(hndClient, hndVConn, uTid, uMsgId, bufReq, uReqLen);
    DListVoidQueue(pThCtl->m_queue, pThReq);
    ThSyncSignal(pThCtl);
    LOGDIAG3("%s: Service Thread \"%s\": queue depth=%u.",
      ServerHasName(), pThCtl->m_sDevUri, DListVoidCount(pThCtl->m_queue)); 
    rc = BS_OK;
  }
  else
  {
    rc = -BS_ECODE_NO_RSRC;
    BSPROXY_TH_LOG_ERROR(pThCtl->m_sDevUri, rc, "Queue overflow.");
  }
   unlock thread and queue
  ThSyncUnlock(pThCtl);
  return rc;
}
int ThQueue ( BsProxyThCtl_T * pThCtl , BsProxyClientHnd_T hndClient , BsVConnHnd_T hndVConn , BsTid_T uTid , BsMsgId_T uMsgId , byte_t bufReq [ ] , size_t uReqLen ) { BsProxyThReq_T * pThReq ; int rc ; ThSyncLock ( pThCtl ) ; if ( DListVoidCount ( pThCtl -> m_queue ) < BSPROXY_TH_MAX_QUEUE_SIZE ) { pThReq = ThReqNew ( hndClient , hndVConn , uTid , uMsgId , bufReq , uReqLen ) ; DListVoidQueue ( pThCtl -> m_queue , pThReq ) ; ThSyncSignal ( pThCtl ) ; LOGDIAG3 ( " \" \" " , ServerHasName ( ) , pThCtl -> m_sDevUri , DListVoidCount ( pThCtl -> m_queue ) ) ; rc = BS_OK ; } else { rc = - BS_ECODE_NO_RSRC ; BSPROXY_TH_LOG_ERROR ( pThCtl -> m_sDevUri , rc , " " ) ; } ThSyncUnlock ( pThCtl ) ; return rc ; }
\brief Queue a request for the given service thread.
\ brief Queue a request for the given service thread .
// lock thread and queue // // Queue request on thread's message queue. // // unlock thread and queue