本文整理汇总了C++中RTSemEventSignal函数的典型用法代码示例。如果您正苦于以下问题:C++ RTSemEventSignal函数的具体用法?C++ RTSemEventSignal怎么用?C++ RTSemEventSignal使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RTSemEventSignal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssertReturnVoid
/**
* Sends a signal to the thread to rescan the clients/VMs having open sessions.
*/
void VirtualBox::ClientWatcher::update()
{
AssertReturnVoid(mThread != NIL_RTTHREAD);
LogFlowFunc(("ping!\n"));
/* sent an update request */
#if defined(RT_OS_WINDOWS)
ASMAtomicWriteBool(&mfUpdateReq, true);
::SetEvent(mUpdateReq);
#elif defined(RT_OS_OS2)
RTSemEventSignal(mUpdateReq);
#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
/* use short timeouts, as we expect changes */
ASMAtomicUoWriteU8(&mUpdateAdaptCtr, RT_ELEMENTS(s_aUpdateTimeoutSteps) - 1);
RTSemEventSignal(mUpdateReq);
#elif defined(VBOX_WITH_GENERIC_SESSION_WATCHER)
RTSemEventSignal(mUpdateReq);
#else
# error "Port me!"
#endif
}
示例2: AssertMsg
int GuestWaitEventBase::SignalInternal(int rc, int guestRc,
const GuestWaitEventPayload *pPayload)
{
if (ASMAtomicReadBool(&mfAborted))
return VERR_CANCELLED;
#ifdef VBOX_STRICT
if (rc == VERR_GSTCTL_GUEST_ERROR)
AssertMsg(RT_FAILURE(guestRc), ("Guest error indicated but no actual guest error set (%Rrc)\n", guestRc));
else
AssertMsg(RT_SUCCESS(guestRc), ("No guest error indicated but actual guest error set (%Rrc)\n", guestRc));
#endif
int rc2;
if (pPayload)
rc2 = mPayload.CopyFromDeep(*pPayload);
else
rc2 = VINF_SUCCESS;
if (RT_SUCCESS(rc2))
{
mRc = rc;
mGuestRc = guestRc;
rc2 = RTSemEventSignal(mEventSem);
}
return rc2;
}
示例3: RTDECL
RTDECL(int) RTSemSpinMutexRelease(RTSEMSPINMUTEX hSpinMtx)
{
RTSEMSPINMUTEXINTERNAL *pThis = hSpinMtx;
RTNATIVETHREAD hSelf = RTThreadNativeSelf();
uint32_t cLockers;
RTSEMSPINMUTEXSTATE State;
bool fRc;
Assert(hSelf != NIL_RTNATIVETHREAD);
RTSEMSPINMUTEX_VALIDATE_RETURN(pThis);
/*
* Get the saved state and try release the semaphore.
*/
State = pThis->SavedState;
ASMCompilerBarrier();
ASMAtomicCmpXchgHandle(&pThis->hOwner, NIL_RTNATIVETHREAD, hSelf, fRc);
AssertMsgReturn(fRc,
("hOwner=%p hSelf=%p cLockers=%d\n", pThis->hOwner, hSelf, pThis->cLockers),
VERR_NOT_OWNER);
cLockers = ASMAtomicDecS32(&pThis->cLockers);
rtSemSpinMutexLeave(&State);
if (cLockers > 0)
{
int rc = RTSemEventSignal(pThis->hEventSem);
AssertReleaseMsg(RT_SUCCESS(rc), ("RTSemEventSignal -> %Rrc\n", rc));
}
return VINF_SUCCESS;
}
示例4: DECLCALLBACK
/**
* @copydoc FNPDMDRVDESTRUCT
*/
static DECLCALLBACK(void) drvdiskintDestruct(PPDMDRVINS pDrvIns)
{
PDRVDISKINTEGRITY pThis = PDMINS_2_DATA(pDrvIns, PDRVDISKINTEGRITY);
if (pThis->pTreeSegments)
{
RTAvlrFileOffsetDestroy(pThis->pTreeSegments, drvdiskintTreeDestroy, NULL);
RTMemFree(pThis->pTreeSegments);
}
if (pThis->fTraceRequests)
{
pThis->fRunning = false;
RTSemEventSignal(pThis->SemEvent);
RTSemEventDestroy(pThis->SemEvent);
}
if (pThis->fCheckDoubleCompletion)
{
/* Free all requests */
while (pThis->papIoReq[pThis->iEntry])
{
RTMemFree(pThis->papIoReq[pThis->iEntry]);
pThis->papIoReq[pThis->iEntry] = NULL;
pThis->iEntry = (pThis->iEntry+1) % pThis->cEntries;
}
}
if (pThis->hIoLogger)
VDDbgIoLogDestroy(pThis->hIoLogger);
}
示例5: SUPDECL
SUPDECL(int) SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent)
{
int rc;
uint32_t h32;
PSUPDRVOBJ pObj;
/*
* Input validation.
*/
AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
h32 = (uint32_t)(uintptr_t)hEvent;
if (h32 != (uintptr_t)hEvent)
return VERR_INVALID_HANDLE;
pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT);
if (!pObj)
return VERR_INVALID_HANDLE;
/*
* Do the job.
*/
rc = RTSemEventSignal((RTSEMEVENT)pObj->pvUser1);
SUPR0ObjRelease(pObj, pSession);
return rc;
}
示例6: LogFlowThisFunc
/**
* Uninitializes the instance and sets the ready flag to FALSE.
* Called either from FinalRelease() or by the parent when it gets destroyed.
*/
void VirtualBoxClient::uninit()
{
LogFlowThisFunc(("\n"));
/* Enclose the state transition Ready->InUninit->NotReady */
AutoUninitSpan autoUninitSpan(this);
if (autoUninitSpan.uninitDone())
return;
if (mData.m_ThreadWatcher != NIL_RTTHREAD)
{
/* Signal the event semaphore and wait for the thread to terminate.
* if it hangs for some reason exit anyway, this can cause a crash
* though as the object will no longer be available. */
RTSemEventSignal(mData.m_SemEvWatcher);
RTThreadWait(mData.m_ThreadWatcher, 30000, NULL);
mData.m_ThreadWatcher = NIL_RTTHREAD;
RTSemEventDestroy(mData.m_SemEvWatcher);
mData.m_SemEvWatcher = NIL_RTSEMEVENT;
}
mData.m_pVirtualBox.setNull();
ASMAtomicDecU32(&g_cInstances);
}
示例7: hostMonitoringRoutine
static int hostMonitoringRoutine(RTTHREAD ThreadSelf, void *pvUser)
{
NOREF(ThreadSelf);
NOREF(pvUser);
g_RunLoopRef = CFRunLoopGetCurrent();
AssertReturn(g_RunLoopRef, VERR_INTERNAL_ERROR);
CFRetain(g_RunLoopRef);
CFArrayRef watchingArrayRef = CFArrayCreate(NULL,
(const void **)&kStateNetworkGlobalDNSKey,
1, &kCFTypeArrayCallBacks);
if (!watchingArrayRef)
{
CFRelease(g_DnsWatcher);
return E_OUTOFMEMORY;
}
if(SCDynamicStoreSetNotificationKeys(g_store, watchingArrayRef, NULL))
CFRunLoopAddSource(CFRunLoopGetCurrent(), g_DnsWatcher, kCFRunLoopCommonModes);
CFRelease(watchingArrayRef);
RTSemEventSignal(g_DnsInitEvent);
CFRunLoopRun();
CFRelease(g_RunLoopRef);
return VINF_SUCCESS;
}
示例8: LogFlowFunc
int UIDnDDataObject::Signal(const QString &strFormat,
const void *pvData, uint32_t cbData)
{
LogFlowFunc(("Signalling ...\n"));
int rc;
SetStatus(Dropped);
mstrFormat = strFormat;
if (cbData)
{
mpvData = RTMemAlloc(cbData);
if (mpvData)
{
memcpy(mpvData, pvData, cbData);
mcbData = cbData;
rc = VINF_SUCCESS;
}
else
rc = VERR_NO_MEMORY;
}
else
rc = VINF_SUCCESS;
if (RT_FAILURE(rc))
mStatus = Aborted;
/* Signal in any case. */
int rc2 = RTSemEventSignal(mSemEvent);
if (RT_SUCCESS(rc))
rc = rc2;
return rc;
}
示例9: CFRunLoopGetCurrent
int HostDnsServiceDarwin::monitorWorker()
{
m->m_RunLoopRef = CFRunLoopGetCurrent();
AssertReturn(m->m_RunLoopRef, VERR_INTERNAL_ERROR);
CFRetain(m->m_RunLoopRef);
CFArrayRef watchingArrayRef = CFArrayCreate(NULL,
(const void **)&kStateNetworkGlobalDNSKey,
1, &kCFTypeArrayCallBacks);
if (!watchingArrayRef)
{
CFRelease(m->m_DnsWatcher);
return E_OUTOFMEMORY;
}
if(SCDynamicStoreSetNotificationKeys(m->m_store, watchingArrayRef, NULL))
CFRunLoopAddSource(CFRunLoopGetCurrent(), m->m_DnsWatcher, kCFRunLoopCommonModes);
CFRelease(watchingArrayRef);
monitorThreadInitializationDone();
while (!m->m_fStop)
{
CFRunLoopRun();
}
CFRelease(m->m_RunLoopRef);
/* We're notifying stopper thread. */
RTSemEventSignal(m->m_evtStop);
return VINF_SUCCESS;
}
示例10: vboxNetAdpDarwinDetach
static void vboxNetAdpDarwinDetach(ifnet_t pIface)
{
PVBOXNETADP pThis = VBOXNETADP_FROM_IFACE(pIface);
Assert(pThis);
Log2(("vboxNetAdpDarwinDetach: Signaling detach to vboxNetAdpUnregisterDevice.\n"));
/* Let vboxNetAdpDarwinUnregisterDevice know that the interface has been detached. */
RTSemEventSignal(pThis->u.s.hEvtDetached);
}
示例11: AssertReturn
int GuestCtrlEvent::Signal(int rc /*= VINF_SUCCESS*/)
{
AssertReturn(hEventSem != NIL_RTSEMEVENT, VERR_CANCELLED);
mRC = rc;
return RTSemEventSignal(hEventSem);
}
示例12: defined
/** @note To be called only from #close() */
void Session::releaseIPCSemaphore()
{
/* release the IPC semaphore */
#if defined(RT_OS_WINDOWS)
if (mIPCSem && mIPCThreadSem)
{
/*
* tell the thread holding the IPC mutex to release it;
* it will close mIPCSem handle
*/
::SetEvent (mIPCSem);
/* wait for the thread to finish */
::WaitForSingleObject (mIPCThreadSem, INFINITE);
::CloseHandle (mIPCThreadSem);
mIPCThreadSem = NULL;
mIPCSem = NULL;
}
#elif defined(RT_OS_OS2)
if (mIPCThread != NIL_RTTHREAD)
{
Assert (mIPCThreadSem != NIL_RTSEMEVENT);
/* tell the thread holding the IPC mutex to release it */
int vrc = RTSemEventSignal (mIPCThreadSem);
AssertRC(vrc == NO_ERROR);
/* wait for the thread to finish */
vrc = RTThreadUserWait (mIPCThread, RT_INDEFINITE_WAIT);
Assert (RT_SUCCESS(vrc) || vrc == VERR_INTERRUPTED);
mIPCThread = NIL_RTTHREAD;
}
if (mIPCThreadSem != NIL_RTSEMEVENT)
{
RTSemEventDestroy (mIPCThreadSem);
mIPCThreadSem = NIL_RTSEMEVENT;
}
#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
if (mIPCSem >= 0)
{
::sembuf sop = { 0, 1, SEM_UNDO };
::semop (mIPCSem, &sop, 1);
mIPCSem = -1;
}
#else
# error "Port me!"
#endif
}
示例13: AssertReturn
/**
* Signals the event.
*
* @return IPRT status code.
* @param pEvent Public IEvent to associate.
* Optional.
*/
int GuestWaitEvent::SignalExternal(IEvent *pEvent)
{
AssertReturn(mEventSem != NIL_RTSEMEVENT, VERR_CANCELLED);
if (pEvent)
mEvent = pEvent;
return RTSemEventSignal(mEventSem);
}
示例14: DECLCALLBACK
/**
* Bootstrap VMR3NotifyFF() worker.
*
* @param pUVCpu Pointer to the user mode VMCPU structure.
* @param fFlags Notification flags, VMNOTIFYFF_FLAGS_*.
*/
static DECLCALLBACK(void) vmR3BootstrapNotifyCpuFF(PUVMCPU pUVCpu, uint32_t fFlags)
{
if (pUVCpu->vm.s.fWait)
{
int rc = RTSemEventSignal(pUVCpu->vm.s.EventSemWait);
AssertRC(rc);
}
NOREF(fFlags);
}
示例15: terminateXPCOMQueueThread
/**
* Indicates to the XPCOM thread that it should terminate now.
*/
void terminateXPCOMQueueThread(void)
{
g_fTerminateXPCOMQueueThread = true;
if (g_EventSemXPCOMQueueThread)
{
RTSemEventSignal(g_EventSemXPCOMQueueThread);
RTThreadYield();
}
}