本文整理汇总了C++中RTCritSectLeave函数的典型用法代码示例。如果您正苦于以下问题:C++ RTCritSectLeave函数的具体用法?C++ RTCritSectLeave怎么用?C++ RTCritSectLeave使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RTCritSectLeave函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pdmacFileAioMgrCloseEndpoint
static int pdmacFileAioMgrCloseEndpoint(PPDMACEPFILEMGR pAioMgr, PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint)
{
int rc = RTCritSectEnter(&pAioMgr->CritSectBlockingEvent);
AssertRCReturn(rc, rc);
ASMAtomicWritePtr(&pAioMgr->BlockingEventData.CloseEndpoint.pEndpoint, pEndpoint);
rc = pdmacFileAioMgrWaitForBlockingEvent(pAioMgr, PDMACEPFILEAIOMGRBLOCKINGEVENT_CLOSE_ENDPOINT);
ASMAtomicWriteNullPtr(&pAioMgr->BlockingEventData.CloseEndpoint.pEndpoint);
RTCritSectLeave(&pAioMgr->CritSectBlockingEvent);
return rc;
}
示例2: AssertPtr
bool VBoxCredPoller::QueryCredentials(VBoxCredential *pCred)
{
AssertPtr(pCred);
RTCritSectEnter(&m_csCredUpate);
pCred->Update(m_pszUser, m_pszPw, m_pszDomain);
RTCritSectLeave(&m_csCredUpate);
bool bRet = ( (m_pszUser && strlen(m_pszUser))
|| (m_pszPw && strlen(m_pszPw))
|| (m_pszDomain && strlen(m_pszDomain)));
credentialsReset();
return bRet;
}
示例3: pdmacFileAioMgrShutdown
static int pdmacFileAioMgrShutdown(PPDMACEPFILEMGR pAioMgr)
{
int rc;
rc = RTCritSectEnter(&pAioMgr->CritSectBlockingEvent);
AssertRCReturn(rc, rc);
rc = pdmacFileAioMgrWaitForBlockingEvent(pAioMgr, PDMACEPFILEAIOMGRBLOCKINGEVENT_SHUTDOWN);
RTCritSectLeave(&pAioMgr->CritSectBlockingEvent);
return rc;
}
示例4: AssertPtrReturn
int GuestBase::registerWaitEvent(uint32_t uSessionID, uint32_t uObjectID,
const GuestEventTypes &lstEvents,
GuestWaitEvent **ppEvent)
{
AssertPtrReturn(ppEvent, VERR_INVALID_POINTER);
uint32_t uContextID;
int rc = generateContextID(uSessionID, uObjectID, &uContextID);
if (RT_FAILURE(rc))
return rc;
rc = RTCritSectEnter(&mWaitEventCritSect);
if (RT_SUCCESS(rc))
{
try
{
GuestWaitEvent *pEvent = new GuestWaitEvent(uContextID, lstEvents);
AssertPtr(pEvent);
LogFlowThisFunc(("New event=%p, CID=%RU32\n", pEvent, uContextID));
/* Insert event into matching event group. This is for faster per-group
* lookup of all events later. */
for (GuestEventTypes::const_iterator itEvents = lstEvents.begin();
itEvents != lstEvents.end(); itEvents++)
{
mWaitEventGroups[(*itEvents)].insert(
std::pair<uint32_t, GuestWaitEvent*>(uContextID, pEvent));
/** @todo Check for key collision. */
}
/* Register event in regular event list. */
/** @todo Check for key collisions. */
mWaitEvents[uContextID] = pEvent;
*ppEvent = pEvent;
}
catch(std::bad_alloc &)
{
rc = VERR_NO_MEMORY;
}
int rc2 = RTCritSectLeave(&mWaitEventCritSect);
if (RT_SUCCESS(rc))
rc = rc2;
}
return rc;
}
示例5: 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);
}
示例6: pdmR3ThreadDestroyAll
/**
* Called For VM power off.
*
* @param pVM Pointer to the VM.
*/
void pdmR3ThreadDestroyAll(PVM pVM)
{
PUVM pUVM = pVM->pUVM;
RTCritSectEnter(&pUVM->pdm.s.ListCritSect);
PPDMTHREAD pThread = pUVM->pdm.s.pThreads;
while (pThread)
{
PPDMTHREAD pNext = pThread->Internal.s.pNext;
int rc2 = PDMR3ThreadDestroy(pThread, NULL);
AssertRC(rc2);
pThread = pNext;
}
Assert(!pUVM->pdm.s.pThreads && !pUVM->pdm.s.pThreadsTail);
RTCritSectLeave(&pUVM->pdm.s.ListCritSect);
}
示例7: RTCritSectEnter
STDMETHODIMP HostDnsService::COMGETTER(NameServers)(ComSafeArrayOut(BSTR, aNameServers))
{
RTCritSectEnter(&m_hCritSect);
com::SafeArray<BSTR> nameServers(m_llNameServers.size());
Utf8StrListIterator it;
int i = 0;
for (it = m_llNameServers.begin(); it != m_llNameServers.end(); ++it, ++i)
(*it).cloneTo(&nameServers[i]);
nameServers.detachTo(ComSafeArrayOutArg(aNameServers));
RTCritSectLeave(&m_hCritSect);
return S_OK;
}
示例8: txsTcpSetClient
/**
* Sets the current client socket in a safe manner.
*
* @returns NIL_RTSOCKET if consumed, other wise hTcpClient.
* @param hTcpClient The client socket.
* @param fFromServer Set if server type connection.
*/
static RTSOCKET txsTcpSetClient(RTSOCKET hTcpClient, bool fFromServer)
{
RTCritSectEnter(&g_TcpCritSect);
if ( g_hTcpClient == NIL_RTSOCKET
&& !g_fTcpStopConnecting
&& g_hThreadMain != NIL_RTTHREAD
)
{
g_fTcpClientFromServer = true;
g_hTcpClient = hTcpClient;
int rc = RTThreadUserSignal(g_hThreadMain); AssertRC(rc);
hTcpClient = NIL_RTSOCKET;
}
RTCritSectLeave(&g_TcpCritSect);
return hTcpClient;
}
示例9: VMMR3DECL
/**
* Leave all critical sections the calling thread owns.
*
* This is only used when entering guru meditation in order to prevent other
* EMTs and I/O threads from deadlocking.
*
* @param pVM Pointer to the VM.
*/
VMMR3DECL(void) PDMR3CritSectLeaveAll(PVM pVM)
{
RTNATIVETHREAD const hNativeSelf = RTThreadNativeSelf();
PUVM pUVM = pVM->pUVM;
RTCritSectEnter(&pUVM->pdm.s.ListCritSect);
for (PPDMCRITSECTINT pCur = pUVM->pdm.s.pCritSects;
pCur;
pCur = pCur->pNext)
{
while ( pCur->Core.NativeThreadOwner == hNativeSelf
&& pCur->Core.cNestings > 0)
PDMCritSectLeave((PPDMCRITSECT)pCur);
}
RTCritSectLeave(&pUVM->pdm.s.ListCritSect);
}
示例10: rtMpSolarisGetFrequency
/**
* Worker for RTMpGetCurFrequency and RTMpGetMaxFrequency.
*
* @returns The desired frequency on success, 0 on failure.
*
* @param idCpu The CPU ID.
* @param pszStatName The cpu_info stat name.
*/
static uint64_t rtMpSolarisGetFrequency(RTCPUID idCpu, const char *pszStatName)
{
uint64_t u64 = 0;
int rc = RTOnceEx(&g_MpSolarisOnce, rtMpSolarisOnce, rtMpSolarisCleanUp, NULL /* pvUser */);
if (RT_SUCCESS(rc))
{
if ( idCpu < g_capCpuInfo
&& g_papCpuInfo[idCpu])
{
rc = RTCritSectEnter(&g_MpSolarisCritSect);
AssertRC(rc);
if (RT_SUCCESS(rc))
{
if (kstat_read(g_pKsCtl, g_papCpuInfo[idCpu], 0) != -1)
{
/* Solaris really need to fix their APIs. Explicitly cast for now. */
kstat_named_t *pStat = (kstat_named_t *)kstat_data_lookup(g_papCpuInfo[idCpu], (char*)pszStatName);
if (pStat)
{
Assert(pStat->data_type == KSTAT_DATA_UINT64 || pStat->data_type == KSTAT_DATA_LONG);
switch (pStat->data_type)
{
case KSTAT_DATA_UINT64: u64 = pStat->value.ui64; break; /* current_clock_Hz */
case KSTAT_DATA_INT32: u64 = pStat->value.i32; break; /* clock_MHz */
/* just in case... */
case KSTAT_DATA_UINT32: u64 = pStat->value.ui32; break;
case KSTAT_DATA_INT64: u64 = pStat->value.i64; break;
default:
AssertMsgFailed(("%d\n", pStat->data_type));
break;
}
}
else
Log(("kstat_data_lookup(%s) -> %d\n", pszStatName, errno));
}
else
Log(("kstat_read() -> %d\n", errno));
RTCritSectLeave(&g_MpSolarisCritSect);
}
}
else
Log(("invalid idCpu: %d (g_capCpuInfo=%d)\n", (int)idCpu, (int)g_capCpuInfo));
}
return u64;
}
示例11: VMMDECL
/**
* Deletes all remaining critical sections.
*
* This is called at the very end of the termination process. It is also called
* at the end of vmR3CreateU failure cleanup, which may cause it to be called
* twice depending on where vmR3CreateU actually failed. We have to do the
* latter call because other components expect the critical sections to be
* automatically deleted.
*
* @returns VBox status.
* First error code, rest is lost.
* @param pVMU The user mode VM handle.
* @remark Don't confuse this with PDMR3CritSectDelete.
*/
VMMDECL(int) PDMR3CritSectTerm(PVM pVM)
{
PUVM pUVM = pVM->pUVM;
int rc = VINF_SUCCESS;
RTCritSectEnter(&pUVM->pdm.s.ListCritSect);
while (pUVM->pdm.s.pCritSects)
{
int rc2 = pdmR3CritSectDeleteOne(pVM, pUVM, pUVM->pdm.s.pCritSects, NULL, true /* final */);
AssertRC(rc2);
if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
rc = rc2;
}
RTCritSectLeave(&pUVM->pdm.s.ListCritSect);
return rc;
}
示例12: pdmacFileAioMgrAddEndpoint
int pdmacFileAioMgrAddEndpoint(PPDMACEPFILEMGR pAioMgr, PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint)
{
LogFlowFunc(("pAioMgr=%#p pEndpoint=%#p{%s}\n", pAioMgr, pEndpoint, pEndpoint->Core.pszUri));
/* Update the assigned I/O manager. */
ASMAtomicWritePtr(&pEndpoint->pAioMgr, pAioMgr);
int rc = RTCritSectEnter(&pAioMgr->CritSectBlockingEvent);
AssertRCReturn(rc, rc);
ASMAtomicWritePtr(&pAioMgr->BlockingEventData.AddEndpoint.pEndpoint, pEndpoint);
rc = pdmacFileAioMgrWaitForBlockingEvent(pAioMgr, PDMACEPFILEAIOMGRBLOCKINGEVENT_ADD_ENDPOINT);
ASMAtomicWriteNullPtr(&pAioMgr->BlockingEventData.AddEndpoint.pEndpoint);
RTCritSectLeave(&pAioMgr->CritSectBlockingEvent);
return rc;
}
示例13: pdmNsBwGroupFindById
static PPDMNSBWGROUP pdmNsBwGroupFindById(PPDMNETSHAPER pShaper, const char *pcszId)
{
PPDMNSBWGROUP pBwGroup = NULL;
if (RT_VALID_PTR(pcszId))
{
int rc = RTCritSectEnter(&pShaper->cs); AssertRC(rc);
pBwGroup = pShaper->pBwGroupsHead;
while ( pBwGroup
&& RTStrCmp(pBwGroup->pszName, pcszId))
pBwGroup = pBwGroup->pNext;
rc = RTCritSectLeave(&pShaper->cs); AssertRC(rc);
}
return pBwGroup;
}
示例14: renderspuVBoxCompositorAcquire
struct VBOXVR_SCR_COMPOSITOR * renderspuVBoxCompositorAcquire( WindowInfo *window)
{
int rc = RTCritSectEnter(&window->CompositorLock);
if (RT_SUCCESS(rc))
{
VBOXVR_SCR_COMPOSITOR * pCompositor = window->pCompositor;
if (pCompositor)
return pCompositor;
/* if no compositor is set, release the lock and return */
RTCritSectLeave(&window->CompositorLock);
}
else
{
crWarning("RTCritSectEnter failed rc %d", rc);
}
return NULL;
}
示例15: VGSvcLogV
/**
* Logs a verbose message.
*
* @param pszFormat The message text.
* @param va Format arguments.
*/
void VGSvcLogV(const char *pszFormat, va_list va)
{
#ifdef DEBUG
int rc = RTCritSectEnter(&g_csLog);
if (RT_SUCCESS(rc))
{
#endif
char *psz = NULL;
RTStrAPrintfV(&psz, pszFormat, va);
AssertPtr(psz);
LogRel(("%s", psz));
RTStrFree(psz);
#ifdef DEBUG
RTCritSectLeave(&g_csLog);
}
#endif
}