static void
DestroyTransp(CommTransp transp)
{
   CommTranspID transpID;
   int32 rc;

   if (!transp) {
      CommOS_Debug(("Failed to close channel: Bad handle\n"));
      return;
   }

   CommOS_Log(("%s: Detaching channel [%u:%u]\n",
               __FUNCTION__,
               transp->qp->id.context,
               transp->qp->id.resource));

   transpID.d32[0] = transp->qp->id.context;
   transpID.d32[1] = transp->qp->id.resource;

#if !defined(COMM_BUILDING_SERVER)
   /*
    * Tell the host to detach, will block in the host
    * until the host has unmapped memory. Once the
    * host has unmapped, it is safe to free.
    */
   CommTranspEvent_Raise(transp->peerEvID,
                         &transpID,
                         COMM_TRANSP_IO_DETACH);
#endif

   rc = QP_Detach(transp->qp);

#if defined(COMM_BUILDING_SERVER)
   /*
    * Wake up waiters now that unmapping is complete
    */
   CommOS_WakeUp(&transpTable[transp->backRef].wq);
#endif

   CommOS_Kfree(transp);
   if (rc != QP_SUCCESS) {
      CommOS_Log(("%s: Failed to detach. rc: %d\n", __FUNCTION__, rc));
   } else {
      CommOS_Log(("%s: Channel detached.\n", __FUNCTION__));
   }
}
Beispiel #2
0
static void
DestroyTransp(CommTransp transp)
{
    CommTranspID transpID;
    int32 rc;

    if (!transp) {
        CommOS_Debug(("Failed to close channel: Bad handle\n"));
        return;
    }

    CommOS_Log(("%s: Detaching channel [%u:%u]\n",
                __FUNCTION__,
                transp->qp->id.context,
                transp->qp->id.resource));

    transpID.d32[0] = transp->qp->id.context;
    transpID.d32[1] = transp->qp->id.resource;

#if !defined(COMM_BUILDING_SERVER)
    CommTranspEvent_Raise(transp->peerEvID,
                          &transpID,
                          COMM_TRANSP_IO_DETACH);
#endif

    rc = QP_Detach(transp->qp);

#if defined(COMM_BUILDING_SERVER)
    CommOS_WakeUp(&transpTable[transp->backRef].wq);
#endif

    CommOS_Kfree(transp);
    if (rc != QP_SUCCESS) {
        CommOS_Log(("%s: Failed to detach. rc: %d\n", __FUNCTION__, rc));
    } else {
        CommOS_Log(("%s: Channel detached.\n", __FUNCTION__));
    }
}