本文整理汇总了C++中PulseEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ PulseEvent函数的具体用法?C++ PulseEvent怎么用?C++ PulseEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PulseEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WaitForSingleObject
int tCircularBuffer::insertData(char *data, int count)
{
long i = 0;
long pos = 0;
tBufReader *P;
WaitForSingleObject(hSemafor,1000);
ResetEvent(hSemafor);
while (count>0)
{
i=(bufferEnd+count<bufferSize ? count : bufferSize-bufferEnd);
CopyMemory((void*)&buffer[bufferEnd], (void*)&data[pos], i); nowInBuffer=nowInBuffer+i;
P=FirstReader;
while (P!=NULL)
{
P->nowInBuffer=P->nowInBuffer+i;
if (P->in_event_id!=0) PulseEvent(P->in_event_id);
P=P->nextreader;
}
pos=pos+i;
count=count-i;
bufferEnd=bufferEnd+i;
if (bufferEnd>=bufferSize) bufferEnd=0;
}
SetEvent(hSemafor);
if (in_event_id!=0) PulseEvent(in_event_id);
return 0;
}
示例2: IPCLock
void IPC::process()
{
IPCLock(this);
for (unsigned i = 0; i < N_SLOTS; i++){
if (s[i] != SLOT_IN)
continue;
QString in;
QString out;
string name = prefix();
name += number(i);
HANDLE hMem = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, name.c_str());
if (hMem == NULL){
s[i] = SLOT_NONE;
PulseEvent(hEventOut);
continue;
}
unsigned short *mem = (unsigned short*)MapViewOfFile(hMem, FILE_MAP_ALL_ACCESS, 0, 0, 0);
if (mem == NULL){
log(L_WARN, "Map error");
s[i] = SLOT_NONE;
PulseEvent(hEventOut);
continue;
}
unsigned short *p;
for (p = mem; *p; p++)
in += QChar(*p);
bool bError = false;
bool bRes = remote->command(in, out, bError);
p = mem;
unsigned size = 0;
if (!bError){
if (bRes){
*(p++) = QChar('>').unicode();
}else{
*(p++) = QChar('?').unicode();
}
size = out.length();
if (size > 0x3F00)
size = 0x3F00;
memcpy(p, out.unicode(), size * sizeof(unsigned short));
size++;
}
p[size] = 0;
UnmapViewOfFile(mem);
CloseHandle(hMem);
s[i] = SLOT_OUT;
PulseEvent(hEventOut);
}
}
示例3: FIXFILENAME
DLL_EXPORT
BOOL FishHang_PulseEvent
(
const char* pszFilePosted, // source file that signalled it
const int nLinePosted, // line number of source file
HANDLE hEvent // handle to event object
)
{
FISH_THREAD* pFISH_THREAD;
FISH_EVENT* pFISH_EVENT;
FIXFILENAME(pszFilePosted);
LockFishHang();
if (!GetThreadAndEventPtrs(&pFISH_THREAD,&pFISH_EVENT,hEvent))
FishHangAbort(pszFilePosted,nLinePosted);
GetSystemTime(&pFISH_EVENT->timeSet);
GetSystemTime(&pFISH_EVENT->timeReset);
pFISH_EVENT->pWhoSet = pFISH_THREAD;
pFISH_EVENT->pWhoReset = pFISH_THREAD;
pFISH_EVENT->pszFileSet = pszFilePosted;
pFISH_EVENT->pszFileReset = pszFilePosted;
pFISH_EVENT->nLineSet = nLinePosted;
pFISH_EVENT->nLineReset = nLinePosted;
UnlockFishHang();
return PulseEvent(hEvent);
}
示例4: TIME_TriggerCallBack
static void TIME_TriggerCallBack(LPWINE_TIMERENTRY lpTimer)
{
TRACE("%04lx:CallBack => lpFunc=%p wTimerID=%04X dwUser=%08lX dwTriggerTime %ld(delta %ld)\n",
GetCurrentThreadId(), lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser,
lpTimer->dwTriggerTime, GetTickCount() - lpTimer->dwTriggerTime);
/* - TimeProc callback that is called here is something strange, under Windows 3.1x it is called
* during interrupt time, is allowed to execute very limited number of API calls (like
* PostMessage), and must reside in DLL (therefore uses stack of active application). So I
* guess current implementation via SetTimer has to be improved upon.
*/
switch (lpTimer->wFlags & 0x30) {
case TIME_CALLBACK_FUNCTION:
(lpTimer->lpFunc)(lpTimer->wTimerID, 0, lpTimer->dwUser, 0, 0);
break;
case TIME_CALLBACK_EVENT_SET:
SetEvent((HANDLE)lpTimer->lpFunc);
break;
case TIME_CALLBACK_EVENT_PULSE:
PulseEvent((HANDLE)lpTimer->lpFunc);
break;
default:
FIXME("Unknown callback type 0x%04x for mmtime callback (%p), ignored.\n",
lpTimer->wFlags, lpTimer->lpFunc);
break;
}
}
示例5: Alert_StartScout
BOOL Alert_StartScout (ULONG *pStatus)
{
if (hScout == 0) // create scout?
{
heScoutWakeup = CreateEvent (NULL, FALSE, FALSE, TEXT("AfsSvrMgr Alert Scout Wakeup"));
DWORD dwThreadID;
if ((hScout = CreateThread (NULL, 0,
(LPTHREAD_START_ROUTINE)Alert_ScoutProc,
NULL, 0,
&dwThreadID)) == NULL)
{
if (pStatus)
*pStatus = GetLastError();
return FALSE;
}
SetThreadPriority (hScout, THREAD_PRIORITY_BELOW_NORMAL);
}
else // or just wake up scout from its slumber?
{
PulseEvent (heScoutWakeup);
}
return TRUE;
}
示例6: compare
DWORD WINAPI compare(LPVOID arg) {
while (1) {
WaitForSingleObject(eventComparator, INFINITE);
for (DWORD i = 0; i < nbThreads - 1; i++) {
if (_tcscmp(entries[i], entries[i + 1])) {
//If entries are different
ExitThread(1);
}
}
/*Check if all entries are "", which means that all the reading
threads have terminated*/
DWORD i = 0;
while (i < nbThreads && !_tcscmp(entries[i], _T(""))) {
i++;
}
if (i == nbThreads) {
//All the reading threads have terminated -->directories are equals
ExitThread(0);
}
EnterCriticalSection(&criticalSection);
counter = 0;
LeaveCriticalSection(&criticalSection);
//Release the reading threads
PulseEvent(eventReaders);
}
}
示例7: assert
bool irsdkMemServer::finalizeHeader()
{
assert(!m_isHeaderFinalized);
if(m_isInitialized && !m_isHeaderFinalized)
{
// copy our local header
memcpy(pHeader, &localHeader, sizeof(localHeader));
// copy over the var header
char *pBase = pSharedMem + localHeader.varHeaderOffset;
memcpy(pBase, &localVarHeader, sizeof(localVarHeader));
// flush caches to all processors
_WriteBarrier();
localHeader.status = irsdk_stConnected;
pHeader->status = irsdk_stConnected;
//should we fire an event?
PulseEvent(hDataValidEvent);
// only write header out once
m_isHeaderFinalized = true;
return true;
}
return false;
}
示例8: PulseEvent
long CCintocxCtrl::Terminate()
{
// TODO: Add your dispatch handler code here
// terminates the application
#ifdef TERMEVENT
// following scheme never worked
if(IsCintThreadActive) {
if(0==EventQue.Push("",NULL,TERMINATEEVENT)) {
#ifndef WIN32EVENT
CintEvent.PulseEvent();
#else
PulseEvent(CintEvent);
#endif
return(0);
}
else {
MessageBeep((WORD)(-1));
return(1);
}
}
#else
exit(0);
#endif
return(0);
}
示例9: pthread_cond_broadcast
int
pthread_cond_broadcast (pthread_cond_t *cv)
{
// Try to release all waiting threads.
BOOL retcode = PulseEvent (cv->events_[cv->BROADCAST]);
return retcode;
}
示例10: signal_quit
void
signal_quit (void)
{
/* Make sure this event never remains signaled; if the main thread
isn't in a blocking call, then this should do nothing. */
PulseEvent (interrupt_handle);
}
示例11: while
WaitObjectContainer::~WaitObjectContainer()
{
try // don't let exceptions escape destructor
{
if (!m_threads.empty())
{
HANDLE threadHandles[MAXIMUM_WAIT_OBJECTS];
unsigned int i;
for (i=0; i<m_threads.size(); i++)
{
WaitingThreadData &thread = *m_threads[i];
while (!thread.waitingToWait) // spin until thread is in the initial "waiting to wait" state
Sleep(0);
thread.terminate = true;
threadHandles[i] = thread.threadHandle;
}
PulseEvent(m_startWaiting);
::WaitForMultipleObjects(m_threads.size(), threadHandles, TRUE, INFINITE);
for (i=0; i<m_threads.size(); i++)
CloseHandle(threadHandles[i]);
CloseHandle(m_startWaiting);
CloseHandle(m_stopWaiting);
}
}
catch (...)
{
}
}
示例12: QueueGet
DWORD QueueGet (QUEUE_OBJECT *q, PVOID msg, DWORD msize, DWORD MaxWait)
{
DWORD TotalWaitTime = 0;
BOOL TimedOut = FALSE;
WaitForSingleObject (q->qGuard, INFINITE);
if (q->msgArray == NULL) return 1; /* Queue has been destroyed */
while (QueueEmpty (q) && !TimedOut)
{
ReleaseMutex (q->qGuard);
WaitForSingleObject (q->qNe, CV_TIMEOUT);
if (MaxWait != INFINITE)
{
TotalWaitTime += CV_TIMEOUT;
TimedOut = (TotalWaitTime > MaxWait);
}
WaitForSingleObject (q->qGuard, INFINITE);
}
/* remove the message from the queue */
if (!TimedOut) QueueRemove (q, msg, msize);
/* Signal that the queue is not full as we've removed a message */
PulseEvent (q->qNf);
ReleaseMutex (q->qGuard);
return TimedOut ? WAIT_TIMEOUT : 0;
}
示例13: pthread_cond_signal
int
pthread_cond_signal (pthread_cond_t *cv)
{
// Try to release one waiting thread.
BOOL retcode = PulseEvent (cv->events_[cv->SIGNAL]);
return retcode;
}
示例14: pthread_cond_broadcast
int pthread_cond_broadcast(pthread_cond_t *cond){
if(TRUE == PulseEvent(*cond))
return 0;
else{
DWORD ret = GetLastError();
return (ret == 0)? -1 : ret;
}
}
示例15: Broadcast
// send a condition signal to wake all threads waiting on condition
void Broadcast( void )
{
#if defined( HAVE_POSIX_THREAD )
pthread_cond_broadcast( &mCondition );
#elif defined( HAVE_WIN32_THREAD )
PulseEvent( mCondition );
#endif
}