当前位置: 首页>>代码示例>>C++>>正文


C++ PulseEvent函数代码示例

本文整理汇总了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;
}
开发者ID:grtxx,项目名称:gss-streaming-server,代码行数:28,代码来源:circbuffer.cpp

示例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);
    }
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:50,代码来源:remote.cpp

示例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);
}
开发者ID:CrashSerious,项目名称:Pi-hercules,代码行数:33,代码来源:fishhang.c

示例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;
    }
}
开发者ID:GYGit,项目名称:reactos,代码行数:27,代码来源:time.c

示例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;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:26,代码来源:alert.cpp

示例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);
	}
}
开发者ID:le-roux,项目名称:System-DeviceProgrammingWindows,代码行数:30,代码来源:ex3.cpp

示例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;
}
开发者ID:SIMRacingApps,项目名称:SIMRacingAppsSIMPluginiRacing,代码行数:28,代码来源:irsdk_memserver.cpp

示例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);
}
开发者ID:309972460,项目名称:software,代码行数:27,代码来源:CintocxCtl.cpp

示例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;
}
开发者ID:berise,项目名称:BTools2,代码行数:7,代码来源:Condition.hpp

示例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);
}
开发者ID:adamdoupe,项目名称:emacs,代码行数:7,代码来源:w32xfns.c

示例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 (...)
	{
	}
}
开发者ID:axxapp,项目名称:winxgui,代码行数:28,代码来源:wait.cpp

示例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;
}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:27,代码来源:QueueObj_noSOAW.c

示例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;
}
开发者ID:berise,项目名称:BTools2,代码行数:8,代码来源:Condition.hpp

示例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;
  }
}
开发者ID:ld-test,项目名称:luq,代码行数:8,代码来源:luq_pthread.c

示例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
    }
开发者ID:chromium-googlesource-mirror,项目名称:sctp-refimpl,代码行数:9,代码来源:Condition.hpp


注:本文中的PulseEvent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。