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


C++ DosResetEventSem函数代码示例

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


在下文中一共展示了DosResetEventSem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getmessage

int getmessage (int interval)
{
    int             key = 0;
    ULONG           posted;

    if (que_n() > 0) return que_get ();
    
    // with interval == 0, we only check for keys in buffer
    if (interval == 0)
    {
        key = 0;
    }
    else if (interval > 0)
    {
        DosResetEventSem (hev_NewMessage, &posted);
        DosWaitEventSem (hev_NewMessage, interval);
        key = que_get ();
    }
    else if (interval < 0)
    {
        DosResetEventSem (hev_NewMessage, &posted);
        DosWaitEventSem (hev_NewMessage, SEM_INDEFINITE_WAIT);
        key = que_get ();
    }
    return key;
}
开发者ID:OS2World,项目名称:LIB-libfly,代码行数:26,代码来源:os2pm.c

示例2: PipeWaitAndResetEventSem

static APIRET PipeWaitAndResetEventSem(HEV *SemHandle)
{
#define EVENTSEM_TIMEOUT SEM_INDEFINITE_WAIT

	APIRET rc;
	ULONG PostCt;

	rc = DosWaitEventSem(*SemHandle, EVENTSEM_TIMEOUT);
	if (!rc) rc = DosResetEventSem(*SemHandle, &PostCt);

	if (rc == ERROR_INVALID_HANDLE)
	{
		rc = DosOpenEventSem(0, SemHandle);

		if (!rc) 
		{
		    rc = DosWaitEventSem(*SemHandle, EVENTSEM_TIMEOUT);
		    if (!rc) rc = DosResetEventSem(*SemHandle, &PostCt);
		}
	}

        if (rc == ERROR_ALREADY_RESET) rc = 0;

	return rc;
}
开发者ID:OS2World,项目名称:UTIL-MEMORY-MemLink,代码行数:25,代码来源:PIPES.C

示例3: NotifyLoopThread

void NotifyLoopThread(MSG *pMsg)
  {
  ULONG ulPostCount;

  DosResetEventSem(hevNotifyLoopSem,&ulPostCount);
  pMsg = pNotifyLoopMsg;
  while (1)
    {
    pMsg->ulMessageNumber = ulMessageNumber++;
    SendMessage(pMsg);
    DosWaitEventSem(hevNotifyLoopSem,5000);
//    DosSleep(300);
    DosResetEventSem(hevNotifyLoopSem,&ulPostCount);
    }
  }
开发者ID:OS2World,项目名称:APP-COMM-ComScope,代码行数:15,代码来源:conn_dlg.c

示例4: vlc_sem_wait

void vlc_sem_wait (vlc_sem_t *sem)
{
    ULONG rc;

    do
    {
        vlc_testcancel ();

        DosRequestMutexSem(sem->wait_mutex, SEM_INDEFINITE_WAIT);

        rc = vlc_WaitForSingleObject (sem->hev, SEM_INDEFINITE_WAIT );

        if (!rc)
        {
            DosRequestMutexSem(sem->count_mutex, SEM_INDEFINITE_WAIT);

            sem->count--;
            if (sem->count == 0)
            {
                ULONG ulPost;

                DosResetEventSem(sem->hev, &ulPost);
            }

            DosReleaseMutexSem(sem->count_mutex);
        }

        DosReleaseMutexSem(sem->wait_mutex);
    } while (rc == ERROR_INTERRUPT);
}
开发者ID:CSRedRat,项目名称:vlc,代码行数:30,代码来源:thread.c

示例5: GetClipText

int GetClipText(ClipData *cd) {
    int rc;
    ULONG PostCount;
    char *mem;
    
    rc = DosOpenMutexSem(SEM_PREFIX "CLIPSYN", &hmtxSyn);
    if (rc != 0) return -1;
    rc = DosOpenEventSem(SEM_PREFIX "CLIPGET", &hevGet);
    if (rc != 0) return -1;
/*    rc = DosOpenEventSem(SEM_PREFIX "CLIPPUT", &hevPut);*/
/*    if (rc != 0) return -1;*/
    rc = DosOpenEventSem(SEM_PREFIX "CLIPEND", &hevEnd);
    if (rc != 0) return -1;
    
    DosRequestMutexSem(hmtxSyn, SEM_INDEFINITE_WAIT);
    DosResetEventSem(hevEnd, &PostCount);
    DosPostEventSem(hevGet);
    DosWaitEventSem(hevEnd, SEM_INDEFINITE_WAIT);
    if (0 == DosGetNamedSharedMem((void **)&mem, MEM_PREFIX "CLIPDATA", PAG_READ | PAG_WRITE)) {
        cd->fLen = *(ULONG*)mem;
        cd->fChar = strdup(mem + 4);
        DosFreeMem(mem);
    } else {
        cd->fLen = 0;
        cd->fChar = 0;
    }
    DosPostEventSem(hevGet);
    DosReleaseMutexSem(hmtxSyn);
/*    DosCloseEventSem(hevPut);*/
    DosCloseEventSem(hevGet);
    DosCloseEventSem(hevEnd);
    DosCloseMutexSem(hmtxSyn);
    return 0;
}
开发者ID:OS2World,项目名称:APP-EDITOR-fte,代码行数:34,代码来源:clip_vio.cpp

示例6: GetPipeEvent

int GetPipeEvent(TEvent *Event) {
  ULONG ulPostCount;
  int   i;

  Event->What = evNone;

  for (i = 0; i < MAX_PIPES; i++) {
    if (Pipes[i].used == 0) continue;

    if (Pipes[i].notify == 0) continue;

    if (DosResetEventSem(Pipes[i].NewData, &ulPostCount) != 0) continue;

    if (ulPostCount > 0) {
      // fprintf(stderr, "Pipe New Data: %d\n", i);
      Event->What        = evNotify;
      Event->Msg.View    = 0;
      Event->Msg.Model   = Pipes[i].notify;
      Event->Msg.Command = cmPipeRead;
      Event->Msg.Param1  = i;
      return 1;
    }
  }
  return 0;
}
开发者ID:AaronDP,项目名称:efte_adbshell,代码行数:25,代码来源:con_os2.cpp

示例7: DosRequestMutexSem

void omni_condition::wait(void)
{
    _internal_omni_thread_helper me;

    DosRequestMutexSem( crit , SEM_INDEFINITE_WAIT );

    me->cond_next = NULL;
    me->cond_prev = waiting_tail;
    if (waiting_head == NULL)
    waiting_head = me;
    else
    waiting_tail->cond_next = me;
    waiting_tail = me;
    me->cond_waiting = TRUE;

    DosReleaseMutexSem( crit );

    mutex->unlock();

    APIRET result =  DosWaitEventSem(me->cond_semaphore, SEM_INDEFINITE_WAIT);
    ULONG c;
    DosResetEventSem(me->cond_semaphore,&c);

    mutex->lock();

    if (result != 0) throw omni_thread_fatal(result);
}
开发者ID:OS2World,项目名称:APP-INTERNET-PMVNC-Server,代码行数:27,代码来源:os2.cpp

示例8: while

void TEventQueue::keyboardThread( void * arg ) {
  arg = arg;
  KBDKEYINFO *info = &TThreads::tiled->keyboardInfo;

  while (1) {
    jsSuspendThread
    USHORT errCode = KbdCharIn( info, IO_NOWAIT, 0 );
    jsSuspendThread
    if ( errCode || (info->fbStatus & 0xC0)!=0x40 || info->fbStatus & 1) { // no char
      keyboardEvent.what = evNothing;
      DosSleep(keyboardPollingDelay);
      if (keyboardPollingDelay < 500) keyboardPollingDelay += 5;
    } else {
    keyboardEvent.what = evKeyDown;

    if ((info->fbStatus & 2) && (info->chChar==0xE0)) info->chChar=0; // OS/2 cursor keys.
    keyboardEvent.keyDown.charScan.charCode=info->chChar;
    keyboardEvent.keyDown.charScan.scanCode=info->chScan;
    shiftState = info->fsState & 0xFF;

    jsSuspendThread

    assert(! DosPostEventSem(TThreads::hevKeyboard1) );

    jsSuspendThread
    assert(! DosWaitEventSem(TThreads::hevKeyboard2, SEM_INDEFINITE_WAIT) );
    keyboardEvent.what = evNothing;
    ULONG dummy;
    jsSuspendThread
    assert(! DosResetEventSem(TThreads::hevKeyboard2, &dummy) );
    keyboardPollingDelay=0;
    }
  }
  TThreads::deadEnd();
}
开发者ID:hackshields,项目名称:antivirus,代码行数:35,代码来源:TEVENT.cpp

示例9: return

unsigned long Event::Reset ( ) {

   if ( Handle == 0 )
      return ( (unsigned long) 0xFFFFFFFF ) ;

   if ( DebugFlag ) Log ( "Event(%s)::Reset.", Tag?Tag:"" ) ;

   BOOL Result = FALSE ;

   #ifdef __OS2__

      ULONG PostCount ;
      APIRET Status = DosResetEventSem ( Handle, &PostCount ) ;
      if ( Status && ( Status != ERROR_ALREADY_RESET ) )
         Result = FALSE ;
      else
         Result = TRUE ;

   #else

      Result = ResetEvent ( Handle ) ;

   #endif

   return ( Result ) ;

} /* endmethod */
开发者ID:OS2World,项目名称:APP-PRODUCTIVITY-Escriba,代码行数:27,代码来源:EVENT.CPP

示例10: DosWaitEventSem

void omni_semaphore::wait(void)
{
    ULONG cnt;
    APIRET rc = DosWaitEventSem(nt_sem, SEM_INDEFINITE_WAIT);
    if (rc != 0)
    throw omni_thread_fatal(rc);
    DosResetEventSem(nt_sem,&cnt);
}
开发者ID:OS2World,项目名称:APP-INTERNET-PMVNC-Server,代码行数:8,代码来源:os2.cpp

示例11: Os2_reset_async_info

/* reset_async_info clear async_info in such a way that fresh add_waiter()
 * calls can be performed.
 */
static void Os2_reset_async_info(void *async_info)
{
   AsyncInfo *ai = async_info;
   ULONG ul;

   DosResetEventSem(ai->sem, &ul);
   ai->mustwait = 0;
}
开发者ID:ErisBlastar,项目名称:osfree,代码行数:11,代码来源:os_os2.c

示例12: BeginSoftModeThread

static void BeginSoftModeThread( thread_data *arglist )
{
    TID         tid;
    ULONG       ulCount;

    DosResetEventSem( BeginThreadSem , &ulCount );
    DosCreateThread( &tid, BeginThreadHelper, (ULONG)arglist, 0, STACK_SIZE );
    DosWaitEventSem( BeginThreadSem, SEM_INDEFINITE_WAIT );
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:9,代码来源:softmode.c

示例13: ReadLoopThread

void APIENTRY ReadLoopThread()
  {
  THREAD *pstThd = pstThread;
  CONFIG *pCfg = &pstThd->stCfg;
  THREADCTRL *pThread = &pstThd->stThread;
  BOOL bReadComplete;
  CHAR *pString;
  APIRET rc;
  BOOL bSkipRead = FALSE;
  char szMessage[80];
  ULONG ulStringLength;
  ULONG ulPostCount;


//  DosSetPriority(PRTYS_THREAD,PRTYC_FOREGROUNDSERVER,-28L,0);
  DosSetPriority(PRTYS_THREAD,PRTYC_REGULAR,-10L,0);
  ulStringLength = pCfg->wReadStringLength;
  DosAllocMem((PPVOID)&pString,10010,(PAG_COMMIT | PAG_WRITE | PAG_READ));
  while (!pThread->bStopThread)
    {
    if (ulStringLength != pCfg->wReadStringLength)
      {
      DosFreeMem(pString);
      ulStringLength = pCfg->wReadStringLength;
      DosAllocMem((PPVOID)&pString,(ulStringLength + 10),(PAG_COMMIT | PAG_WRITE | PAG_READ));
      }
    if (pCfg->bHalfDuplex)
      {
      while ((rc = DosWaitEventSem(hevStartReadSem,10000)) != 0)
        if (rc == ERROR_SEM_TIMEOUT)
          {
          ErrorNotify(pstThd,"Read start semaphore timed out");
          bSkipRead = TRUE;
          }
        else
          {
          sprintf(szMessage,"Read start semaphore error - rc = %u",rc);
          ErrorNotify(pstThd,szMessage);
          }
      DosResetEventSem(hevStartReadSem,&ulPostCount);
      }
    if (bSkipRead)
      bSkipRead = FALSE;
    else
      {
      if (!pCfg->bReadCharacters)
        bReadComplete = ReadString(pstThd,pString);
      else
        bReadComplete = ReadCharacters(pstThd,pString);
      if (bReadComplete)
        DosPostEventSem(hevStartWriteSem);
      }
    }
  DosFreeMem(pString);
  DosPostEventSem(hevKillReadThreadSem);
  DosExit(EXIT_THREAD,0);
  }
开发者ID:OS2World,项目名称:APP-COMM-ComScope,代码行数:57,代码来源:thread.c

示例14: write_os2

static int write_os2(audio_output_t *ao,unsigned char *buf,int len)
{
	/* if we're too quick, let's wait */
	if(nobuffermode)
	{
		MCI_MIX_BUFFER *temp = playingbuffer;
		
		while(
			(tobefilled != (temp = ((BUFFERINFO *) temp->ulUserParm)->NextBuffer)) &&
			(tobefilled != (temp = ((BUFFERINFO *) temp->ulUserParm)->NextBuffer)) &&
			(tobefilled != (temp = ((BUFFERINFO *) temp->ulUserParm)->NextBuffer)) )
		{
			DosResetEventSem(dataplayed,&resetcount);
			DosWaitEventSem(dataplayed, -1);
			temp = playingbuffer;
		}
		
	} else {
		while(tobefilled == playingbuffer)
		{
			DosResetEventSem(dataplayed,&resetcount);
			DosWaitEventSem(dataplayed, -1);
		}
	}
		
	if (justflushed) {
		justflushed = FALSE;
	} else {
		nomoredata = FALSE;
		
		memcpy(tobefilled->pBuffer, buf, len);
		tobefilled->ulBufferLength = len;
		//      ((BUFFERINFO *) tobefilled->ulUserParm)->frameNum = fr->frameNum;
		
		/* if we're out of the water (3rd ahead buffer filled),
		let's reduce our priority */
		if(tobefilled == ( (BUFFERINFO *) ( (BUFFERINFO *) ((BUFFERINFO *) playingbuffer->ulUserParm)->NextBuffer->ulUserParm)->NextBuffer->ulUserParm)->NextBuffer)
			DosSetPriority(PRTYS_THREAD,normalclass,normaldelta,mainthread->tib_ptib2->tib2_ultid);
		
		tobefilled = ((BUFFERINFO *) tobefilled->ulUserParm)->NextBuffer;
	}
	
	return len;
}
开发者ID:IreneKnapp,项目名称:Emerald-Frame,代码行数:44,代码来源:os2.c

示例15: os2KbdQueueQuery

int os2KbdQueueQuery()
{
	ULONG numElements,postCount;
 
	(void)DosQueryQueue(hKbdQueue,&numElements);
	if (numElements!=0) return 0; /* We have something in queue */

	DosResetEventSem(hKbdSem,&postCount);
	return 1;
}
开发者ID:marioaugustorama,项目名称:tropix-xwindow,代码行数:10,代码来源:os2_kbdEv.c


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