• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PulseEvent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PulseEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ PulseEvent函数的具体用法?C++ PulseEvent怎么用?C++ PulseEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PulseEvent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: PulseEvent

void DInputKeyboard::stop(){
	if(m_hThread){
		m_Stop = true;
		PulseEvent(m_hEvent);
	}
	if(m_lpDIDevice) m_lpDIDevice->Unacquire();
	m_lpDIDevice->SetEventNotification(NULL);
}
开发者ID:xuancong84,项目名称:ProjectDIVA,代码行数:8,代码来源:keyboard.cpp


示例17: notify_main_thread

static void SP_CALLCONV notify_main_thread(sp_session *session) {
	DSFYDEBUG("SESSION CALLBACK\n");
#ifdef _WIN32
	PulseEvent(g_notify_event);
#else
	pthread_kill(g_main_thread, SIGIO);
#endif
}
开发者ID:Kitof,项目名称:openspotify,代码行数:8,代码来源:session.c


示例18: Signal

    // send a condition signal to wake one thread waiting on condition
    // in Win32, this actually wakes up all threads, same as Broadcast
    // use PulseEvent to auto-reset the signal after waking all threads
    void Signal( void )
    {
#if   defined( HAVE_POSIX_THREAD )
      pthread_cond_signal( &mCondition );
#elif defined( HAVE_WIN32_THREAD )
      PulseEvent( mCondition );
#endif
    }
开发者ID:chromium-googlesource-mirror,项目名称:sctp-refimpl,代码行数:11,代码来源:Condition.hpp


示例19: EVENT_Pulse

/**
 * Notify all waiters and reset state to non-signaled
 */
Bool EVENT_Pulse(Event * e) 
{
    if (!PulseEvent(e->handle)) {
        ASSMSG1("PulseEvent() failed, error %lu", GetLastError());
        return False;
    }
    return True;
}
开发者ID:fedor4ever,项目名称:packaging,代码行数:11,代码来源:w_event.c


示例20: PulseEvent

void CondVar::Signal()
{
#ifdef WIN32
	PulseEvent(condVarEvent);
#else
	pthread_cond_signal(&condVar);
#endif
}
开发者ID:Stvad,项目名称:PageControllerExample,代码行数:8,代码来源:Thread.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Purge函数代码示例发布时间:2022-05-30
下一篇:
C++ PtrToUlong函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap