本文整理汇总了C++中RTCritSectDelete函数的典型用法代码示例。如果您正苦于以下问题:C++ RTCritSectDelete函数的具体用法?C++ RTCritSectDelete怎么用?C++ RTCritSectDelete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RTCritSectDelete函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rtDbgModDestroy
/**
* Destroys an module after the reference count has reached zero.
*
* @param pDbgMod The module instance.
*/
static void rtDbgModDestroy(PRTDBGMODINT pDbgMod)
{
/*
* Close the debug info interpreter first, then the image interpret.
*/
RTCritSectEnter(&pDbgMod->CritSect); /* paranoia */
if (pDbgMod->pDbgVt)
{
pDbgMod->pDbgVt->pfnClose(pDbgMod);
pDbgMod->pDbgVt = NULL;
pDbgMod->pvDbgPriv = NULL;
}
if (pDbgMod->pImgVt)
{
pDbgMod->pImgVt->pfnClose(pDbgMod);
pDbgMod->pImgVt = NULL;
pDbgMod->pvImgPriv = NULL;
}
/*
* Free the resources.
*/
ASMAtomicWriteU32(&pDbgMod->u32Magic, ~RTDBGMOD_MAGIC);
RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszName);
RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszImgFile);
RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszDbgFile);
RTCritSectLeave(&pDbgMod->CritSect); /* paranoia */
RTCritSectDelete(&pDbgMod->CritSect);
RTMemFree(pDbgMod);
}
开发者ID:virendramishra,项目名称:VirtualBox4.1.18,代码行数:37,代码来源:dbgmod.cpp
示例2: RTDECL
RTDECL(int) RTPipeClose(RTPIPE hPipe)
{
RTPIPEINTERNAL *pThis = hPipe;
if (pThis == NIL_RTPIPE)
return VINF_SUCCESS;
AssertPtrReturn(pThis, VERR_INVALID_PARAMETER);
AssertReturn(pThis->u32Magic == RTPIPE_MAGIC, VERR_INVALID_HANDLE);
/*
* Do the cleanup.
*/
AssertReturn(ASMAtomicCmpXchgU32(&pThis->u32Magic, ~RTPIPE_MAGIC, RTPIPE_MAGIC), VERR_INVALID_HANDLE);
RTCritSectEnter(&pThis->CritSect);
Assert(pThis->cUsers == 0);
if (!pThis->fRead && pThis->fIOPending)
rtPipeWriteCheckCompletion(pThis);
CloseHandle(pThis->hPipe);
pThis->hPipe = INVALID_HANDLE_VALUE;
CloseHandle(pThis->Overlapped.hEvent);
pThis->Overlapped.hEvent = NULL;
RTMemFree(pThis->pbBounceBuf);
pThis->pbBounceBuf = NULL;
RTCritSectLeave(&pThis->CritSect);
RTCritSectDelete(&pThis->CritSect);
RTMemFree(pThis);
return VINF_SUCCESS;
}
开发者ID:greg100795,项目名称:virtualbox,代码行数:34,代码来源:pipe-win.cpp
示例3: pdmacFileAioMgrDestroy
/**
* Destroys a async I/O manager.
*
* @returns nothing.
* @param pAioMgr The async I/O manager to destroy.
*/
static void pdmacFileAioMgrDestroy(PPDMASYNCCOMPLETIONEPCLASSFILE pEpClassFile, PPDMACEPFILEMGR pAioMgr)
{
int rc = pdmacFileAioMgrShutdown(pAioMgr);
AssertRC(rc);
/* Unlink from the list. */
rc = RTCritSectEnter(&pEpClassFile->CritSect);
AssertRC(rc);
PPDMACEPFILEMGR pPrev = pAioMgr->pPrev;
PPDMACEPFILEMGR pNext = pAioMgr->pNext;
if (pPrev)
pPrev->pNext = pNext;
else
pEpClassFile->pAioMgrHead = pNext;
if (pNext)
pNext->pPrev = pPrev;
pEpClassFile->cAioMgrs--;
rc = RTCritSectLeave(&pEpClassFile->CritSect);
AssertRC(rc);
/* Free the resources. */
RTCritSectDelete(&pAioMgr->CritSectBlockingEvent);
RTSemEventDestroy(pAioMgr->EventSem);
if (pAioMgr->enmMgrType != PDMACEPFILEMGRTYPE_SIMPLE)
pdmacFileAioMgrNormalDestroy(pAioMgr);
MMR3HeapFree(pAioMgr);
}
开发者ID:bayasist,项目名称:vbox,代码行数:38,代码来源:PDMAsyncCompletionFile.cpp
示例4: DECLCALLBACK
/**
* @interface_method_impl{TXSTRANSPORT,pfnInit}
*/
static DECLCALLBACK(int) txsTcpInit(void)
{
int rc = RTCritSectInit(&g_TcpCritSect);
if (RT_SUCCESS(rc) && g_enmTcpMode != TXSTCPMODE_CLIENT)
{
rc = RTTcpServerCreateEx(g_szTcpBindAddr[0] ? g_szTcpBindAddr : NULL, g_uTcpBindPort, &g_pTcpServer);
if (RT_FAILURE(rc))
{
if (rc == VERR_NET_DOWN)
{
RTMsgInfo("RTTcpServerCreateEx(%s, %u,) failed: %Rrc, retrying for 20 seconds...\n",
g_szTcpBindAddr[0] ? g_szTcpBindAddr : NULL, g_uTcpBindPort, rc);
uint64_t StartMs = RTTimeMilliTS();
do
{
RTThreadSleep(1000);
rc = RTTcpServerCreateEx(g_szTcpBindAddr[0] ? g_szTcpBindAddr : NULL, g_uTcpBindPort, &g_pTcpServer);
} while ( rc == VERR_NET_DOWN
&& RTTimeMilliTS() - StartMs < 20000);
if (RT_SUCCESS(rc))
RTMsgInfo("RTTcpServerCreateEx succceeded.\n");
}
if (RT_FAILURE(rc))
{
g_pTcpServer = NULL;
RTCritSectDelete(&g_TcpCritSect);
RTMsgError("RTTcpServerCreateEx(%s, %u,) failed: %Rrc\n",
g_szTcpBindAddr[0] ? g_szTcpBindAddr : NULL, g_uTcpBindPort, rc);
}
}
}
return rc;
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:37,代码来源:TestExecServiceTcp.cpp
示例5: hgcmObjUninit
void hgcmObjUninit (void)
{
if (RTCritSectIsInitialized (&g_critsect))
{
RTCritSectDelete (&g_critsect);
}
}
开发者ID:gvsurenderreddy,项目名称:virtualbox,代码行数:7,代码来源:HGCMObjects.cpp
示例6: DECLCALLBACK
/**
* Copy the device and free resources associated with the backend.
*/
static DECLCALLBACK(void) usbProxyWinClose(PUSBPROXYDEV pProxyDev)
{
/* Here we just close the device and free up p->priv
* there is no need to do anything like cancel outstanding requests
* that will have been done already
*/
PPRIV_USBW32 pPriv = USBPROXYDEV_2_DATA(pProxyDev, PPRIV_USBW32);
Assert(pPriv);
if (!pPriv)
return;
Log(("usbProxyWinClose: %p\n", pPriv->hDev));
if (pPriv->hDev != INVALID_HANDLE_VALUE)
{
Assert(pPriv->fClaimed);
USBSUP_RELEASEDEV in;
DWORD cbReturned = 0;
in.bInterfaceNumber = pPriv->bInterfaceNumber;
if (!DeviceIoControl(pPriv->hDev, SUPUSB_IOCTL_USB_RELEASE_DEVICE, &in, sizeof(in), NULL, 0, &cbReturned, NULL))
{
Log(("usbproxy: usbProxyWinClose: DeviceIoControl %#x failed with %#x!!\n", pPriv->hDev, GetLastError()));
}
if (!CloseHandle(pPriv->hDev))
AssertLogRelMsgFailed(("usbproxy: usbProxyWinClose: CloseHandle %#x failed with %#x!!\n", pPriv->hDev, GetLastError()));
pPriv->hDev = INVALID_HANDLE_VALUE;
}
CloseHandle(pPriv->hEventWakeup);
RTCritSectDelete(&pPriv->CritSect);
RTMemFree(pPriv->paQueuedUrbs);
RTMemFree(pPriv->paHandles);
}
开发者ID:mcenirm,项目名称:vbox,代码行数:37,代码来源:USBProxyDevice-win.cpp
示例7: shutdown
VBoxNetBaseService::~VBoxNetBaseService()
{
/*
* Close the interface connection.
*/
if (m)
{
shutdown();
if (m->m_hIf != INTNET_HANDLE_INVALID)
{
INTNETIFCLOSEREQ CloseReq;
CloseReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
CloseReq.Hdr.cbReq = sizeof(CloseReq);
CloseReq.pSession = m->m_pSession;
CloseReq.hIf = m->m_hIf;
m->m_hIf = INTNET_HANDLE_INVALID;
int rc = SUPR3CallVMMR0Ex(NIL_RTR0PTR, NIL_VMCPUID, VMMR0_DO_INTNET_IF_CLOSE, 0, &CloseReq.Hdr);
AssertRC(rc);
}
if (m->m_pSession != NIL_RTR0PTR)
{
SUPR3Term(false /*fForced*/);
m->m_pSession = NIL_RTR0PTR;
}
RTCritSectDelete(&m->m_csThis);
delete m;
m = NULL;
}
}
开发者ID:svn2github,项目名称:virtualbox,代码行数:32,代码来源:VBoxNetBaseService.cpp
示例8: mmR3HeapDestroy
/**
* Destroy a heap.
*
* @param pHeap Heap handle.
*/
void mmR3HeapDestroy(PMMHEAP pHeap)
{
/*
* Start by deleting the lock, that'll trap anyone
* attempting to use the heap.
*/
RTCritSectDelete(&pHeap->Lock);
/*
* Walk the node list and free all the memory.
*/
PMMHEAPHDR pHdr = pHeap->pHead;
while (pHdr)
{
void *pv = pHdr;
pHdr = pHdr->pNext;
RTMemFree(pv);
}
/*
* Free the stat nodes.
*/
/** @todo free all nodes in a AVL tree. */
RTMemFree(pHeap);
}
开发者ID:miguelinux,项目名称:vbox,代码行数:30,代码来源:MMHeap.cpp
示例9: RTCritSectDelete
AutostartDb::~AutostartDb()
{
#ifdef RT_OS_LINUX
RTCritSectDelete(&this->CritSect);
if (m_pszAutostartDbPath)
RTStrFree(m_pszAutostartDbPath);
#endif
}
开发者ID:gvsurenderreddy,项目名称:virtualbox,代码行数:8,代码来源:AutostartDb-generic.cpp
示例10: LogFlowThisFuncEnter
void GuestBase::baseUninit(void)
{
LogFlowThisFuncEnter();
int rc = RTCritSectDelete(&mWaitEventCritSect);
LogFlowFuncLeaveRC(rc);
/* No return value. */
}
开发者ID:bayasist,项目名称:vbox,代码行数:9,代码来源:GuestCtrlPrivate.cpp
示例11: RTCritSectDelete
UIFrameBuffer::~UIFrameBuffer()
{
/* Deinitialize critical-section: */
RTCritSectDelete(&m_critSect);
/* Disconnect handlers: */
if (m_pMachineView)
cleanupConnections();
}
开发者ID:MadHacker217,项目名称:VirtualBox-OSE,代码行数:9,代码来源:UIFrameBuffer.cpp
示例12: vboxfuseNodeDestroy
/**
* Node destructor.
*
* @returns true.
* @param pNode The node.
* @param fLocked Whether it's locked.
*/
static bool vboxfuseNodeDestroy(PVBOXFUSENODE pNode, bool fLocked)
{
Assert(pNode->cRefs == 0);
/*
* Type specific cleanups.
*/
switch (pNode->enmType)
{
case VBOXFUSETYPE_DIRECTORY:
{
PVBOXFUSEDIR pDir = (PVBOXFUSEDIR)pNode;
RTMemFree(pDir->paEntries);
pDir->paEntries = NULL;
pDir->cEntries = 0;
break;
}
case VBOXFUSETYPE_FLAT_IMAGE:
{
PVBOXFUSEFLATIMAGE pFlatImage = (PVBOXFUSEFLATIMAGE)pNode;
if (pFlatImage->pDisk)
{
int rc2 = VDClose(pFlatImage->pDisk, false /* fDelete */); AssertRC(rc2);
pFlatImage->pDisk = NULL;
}
RTStrFree(pFlatImage->pszFormat);
pFlatImage->pszFormat = NULL;
break;
}
case VBOXFUSETYPE_CONTROL_PIPE:
break;
default:
AssertMsgFailed(("%d\n", pNode->enmType));
break;
}
/*
* Generic cleanup.
*/
pNode->enmType = VBOXFUSETYPE_INVALID;
pNode->pszName = NULL;
/*
* Unlock and destroy the lock, before we finally frees the node.
*/
if (fLocked)
RTCritSectLeave(&pNode->CritSect);
RTCritSectDelete(&pNode->CritSect);
RTMemFree(pNode);
return true;
}
开发者ID:leopucci,项目名称:VirtualMonitor,代码行数:63,代码来源:VBoxFUSE.cpp
示例13: RTDECL
RTDECL(int) RTSemSpinMutexDestroy(RTSEMSPINMUTEX hSpinMtx)
{
if (hSpinMtx == NIL_RTSEMSPINMUTEX)
return VERR_INVALID_PARAMETER;
PRTCRITSECT pCritSect = (PRTCRITSECT)hSpinMtx;
int rc = RTCritSectDelete(pCritSect);
if (RT_SUCCESS(rc))
RTMemFree(pCritSect);
return rc;
}
开发者ID:leopucci,项目名称:VirtualMonitor,代码行数:10,代码来源:semspinmutex-r3-generic.cpp
示例14: RTDECL
RTDECL(int) RTLocalIpcServerCreate(PRTLOCALIPCSERVER phServer, const char *pszName, uint32_t fFlags)
{
/*
* Basic parameter validation.
*/
AssertPtrReturn(phServer, VERR_INVALID_POINTER);
AssertPtrReturn(pszName, VERR_INVALID_POINTER);
AssertReturn(*pszName, VERR_INVALID_PARAMETER);
AssertReturn(!(fFlags & ~(RTLOCALIPC_FLAGS_VALID_MASK)), VERR_INVALID_PARAMETER);
AssertReturn((fFlags & RTLOCALIPC_FLAGS_MULTI_SESSION), VERR_INVALID_PARAMETER); /** @todo Implement !RTLOCALIPC_FLAGS_MULTI_SESSION */
/*
* Allocate and initialize the instance data.
*/
size_t cchName = strlen(pszName);
size_t cch = RT_OFFSETOF(RTLOCALIPCSERVERINT, szName[cchName + sizeof(RTLOCALIPC_WIN_PREFIX)]);
PRTLOCALIPCSERVERINT pThis = (PRTLOCALIPCSERVERINT)RTMemAlloc(cch);
if (!pThis)
return VERR_NO_MEMORY;
pThis->u32Magic = RTLOCALIPCSERVER_MAGIC;
pThis->cRefs = 1; /* the one we return */
pThis->fCancelled = false;
memcpy(pThis->szName, RTLOCALIPC_WIN_PREFIX, sizeof(RTLOCALIPC_WIN_PREFIX) - 1);
memcpy(&pThis->szName[sizeof(RTLOCALIPC_WIN_PREFIX) - 1], pszName, cchName + 1);
int rc = RTCritSectInit(&pThis->CritSect);
if (RT_SUCCESS(rc))
{
pThis->hEvent = CreateEvent(NULL /*lpEventAttributes*/, TRUE /*bManualReset*/,
FALSE /*bInitialState*/, NULL /*lpName*/);
if (pThis->hEvent != NULL)
{
RT_ZERO(pThis->OverlappedIO);
pThis->OverlappedIO.Internal = STATUS_PENDING;
pThis->OverlappedIO.hEvent = pThis->hEvent;
rc = rtLocalIpcServerWinCreatePipeInstance(&pThis->hNmPipe,
pThis->szName, true /* fFirst */);
if (RT_SUCCESS(rc))
{
*phServer = pThis;
return VINF_SUCCESS;
}
BOOL fRc = CloseHandle(pThis->hEvent);
AssertMsg(fRc, ("%d\n", GetLastError())); NOREF(fRc);
}
else
rc = RTErrConvertFromWin32(GetLastError());
int rc2 = RTCritSectDelete(&pThis->CritSect);
AssertRC(rc2);
}
RTMemFree(pThis);
return rc;
}
开发者ID:apaka,项目名称:vbox,代码行数:55,代码来源:localipc-win.cpp
示例15: Assert
RemoteUSBBackend::~RemoteUSBBackend()
{
Assert(cRefs == 0);
if (RTCritSectIsInitialized(&mCritsect))
{
RTCritSectDelete(&mCritsect);
}
RTMemFree(mpvDeviceList);
mServer->usbBackendRemoveFromList(this);
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:13,代码来源:RemoteUSBBackend.cpp
示例16: pdmacFileTerminate
static void pdmacFileTerminate(PPDMASYNCCOMPLETIONEPCLASS pClassGlobals)
{
PPDMASYNCCOMPLETIONEPCLASSFILE pEpClassFile = (PPDMASYNCCOMPLETIONEPCLASSFILE)pClassGlobals;
/* All endpoints should be closed at this point. */
AssertMsg(!pEpClassFile->Core.pEndpointsHead, ("There are still endpoints left\n"));
/* Destroy all left async I/O managers. */
while (pEpClassFile->pAioMgrHead)
pdmacFileAioMgrDestroy(pEpClassFile, pEpClassFile->pAioMgrHead);
RTCritSectDelete(&pEpClassFile->CritSect);
}
开发者ID:bayasist,项目名称:vbox,代码行数:13,代码来源:PDMAsyncCompletionFile.cpp
示例17: RTCritSectDelete
EventQueue::~EventQueue(void)
{
int rc = RTCritSectDelete(&mCritSect);
AssertRC(rc);
rc = RTSemEventDestroy(mSemEvent);
AssertRC(rc);
EventQueueListIterator it = mEvents.begin();
while (it != mEvents.end())
{
(*it)->Release();
it = mEvents.erase(it);
}
}
开发者ID:svn2github,项目名称:virtualbox,代码行数:15,代码来源:EventQueue.cpp
示例18: LogFlow
SDLFramebuffer::~SDLFramebuffer()
{
LogFlow(("SDLFramebuffer::~SDLFramebuffer\n"));
RTCritSectDelete(&mUpdateLock);
AssertMsg(mSdlNativeThread == RTThreadNativeSelf(), ("Wrong thread! SDL is not threadsafe!\n"));
SDL_QuitSubSystem(SDL_INIT_VIDEO);
#ifdef VBOX_SECURELABEL
if (mLabelFont)
TTF_CloseFont(mLabelFont);
TTF_Quit();
#endif
mScreen = NULL;
}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:15,代码来源:SDLFramebuffer.cpp
示例19: rtLocalIpcSessionWinDestroy
/**
* Call when the reference count reaches 0.
* Caller owns the critsect.
* @param pThis The instance to destroy.
*/
static void rtLocalIpcSessionWinDestroy(PRTLOCALIPCSESSIONINT pThis)
{
BOOL fRc = CloseHandle(pThis->hNmPipe);
AssertMsg(fRc, ("%d\n", GetLastError())); NOREF(fRc);
pThis->hNmPipe = INVALID_HANDLE_VALUE;
fRc = CloseHandle(pThis->hEvent);
AssertMsg(fRc, ("%d\n", GetLastError())); NOREF(fRc);
pThis->hEvent = NULL;
RTCritSectLeave(&pThis->CritSect);
RTCritSectDelete(&pThis->CritSect);
RTMemFree(pThis);
}
开发者ID:apaka,项目名称:vbox,代码行数:20,代码来源:localipc-win.cpp
示例20: rtLocalIpcWinCreateSession
/**
* Create a session instance.
*
* @returns IPRT status code.
*
* @param phClientSession Where to store the session handle on success.
* @param hNmPipeSession The named pipe handle. This will be consumed by this session, meaning on failure
* to create the session it will be closed.
*/
static int rtLocalIpcWinCreateSession(PRTLOCALIPCSESSION phClientSession, HANDLE hNmPipeSession)
{
AssertPtrReturn(phClientSession, VERR_INVALID_POINTER);
AssertReturn(hNmPipeSession != INVALID_HANDLE_VALUE, VERR_INVALID_HANDLE);
int rc;
/*
* Allocate and initialize the session instance data.
*/
PRTLOCALIPCSESSIONINT pThis = (PRTLOCALIPCSESSIONINT)RTMemAlloc(sizeof(*pThis));
if (pThis)
{
pThis->u32Magic = RTLOCALIPCSESSION_MAGIC;
pThis->cRefs = 1; /* our ref */
pThis->fCancelled = false;
pThis->fIOPending = false;
pThis->fZeroByteRead = false;
pThis->hNmPipe = hNmPipeSession;
rc = RTCritSectInit(&pThis->CritSect);
if (RT_SUCCESS(rc))
{
pThis->hEvent = CreateEvent(NULL /*lpEventAttributes*/, TRUE /*bManualReset*/,
FALSE /*bInitialState*/, NULL /*lpName*/);
if (pThis->hEvent != NULL)
{
RT_ZERO(pThis->OverlappedIO);
pThis->OverlappedIO.Internal = STATUS_PENDING;
pThis->OverlappedIO.hEvent = pThis->hEvent;
*phClientSession = pThis;
return VINF_SUCCESS;
}
/* bail out */
rc = RTErrConvertFromWin32(GetLastError());
RTCritSectDelete(&pThis->CritSect);
}
RTMemFree(pThis);
}
else
rc = VERR_NO_MEMORY;
BOOL fRc = CloseHandle(hNmPipeSession);
AssertMsg(fRc, ("%d\n", GetLastError())); NOREF(fRc);
return rc;
}
开发者ID:apaka,项目名称:vbox,代码行数:57,代码来源:localipc-win.cpp
注:本文中的RTCritSectDelete函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论