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


C++ DosPostEventSem函数代码示例

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


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

示例1: BeginStop

/****************************************************************\
 * Routine to stop semaphore example.                           *
 *--------------------------------------------------------------*
 *                                                              *
 *  Name:     BeginStop(pfAutoMode)                             *
 *                                                              *
 *  Purpose:  Posts stop event semaphore to signal threads to   *
 *            die.  Also posts event to stop Auto mode if       *
 *            necessary. Then waits for threads to complete,    *
 *            Creates thread StopSemaphore which posts stop     *
 *            event and waits for child threads.                *
 *                                                              *
 *  Usage:    Called in file usercmd.c when the user selects    *
 *            Stop from the semaphore menu.                     *
 *                                                              *
 *  Method:   Execs thread to do waits so that message thread   *
 *            doesn't hang.                                     *
 *  Returns:                                                    *
 *                                                              *
\****************************************************************/
VOID BeginStop (PULONG pfAutoMode)
{
   ULONG rc;
   TID tidLocal;

   rc = DosPostEventSem(hevStop);
   if (rc)
   {
       SemError("DosPostEventSem",rc);
       return;
   }
   if (*pfAutoMode)
   {
       rc = DosPostEventSem(hevStopAuto);
       if (rc)
       {
          SemError("DosPostEventSem",rc);
       }
   }
   rc = DosCreateThread((PTID)&tidLocal, (PFNTHREAD)StopSemaphore,
                          (ULONG)pfAutoMode,(ULONG)0,(ULONG) STACKSIZE);
   if (rc)
   {
       SemError("DosCreateThread",rc);
   }
   return;
}
开发者ID:MbqIIB,项目名称:DEV-SAMPLES-IBM_Dev_Toolkit_Samples,代码行数:47,代码来源:semaph.c

示例2: SignalUserEvent

/****************************************************************\
 * Routine to signal consumer to release resource.              *
 *--------------------------------------------------------------*
 *                                                              *
 *  Name:     SignalUserEvent(pfAutoMode)                       *
 *                                                              *
 *  Purpose:  Posts user event semaphore to signal thread to    *
 *            release resource.  Also posts event to stop       *
 *            Auto mode if *pfAutoMode is true.                 *
 *                                                              *
 *  Usage:    Called in file usercmd.c when the user selects    *
 *            Event from the semaphore menu.                    *
 *                                                              *
 *  Method:   Turns off Auto mode, if present by posting auto   *
 *            semaphore.  User event is then posted.            *
 *                                                              *
 *  Returns:                                                    *
 *                                                              *
\****************************************************************/
VOID SignalUserEvent(PULONG pfAutoMode)
{
  ULONG rc;

                          /* If sample is in auto mode turn auto mode off. */
  if (*pfAutoMode)
  {
      rc = DosPostEventSem(hevStopAuto);
      if (rc)
      {
         SemError("DosPostEventSem Stop Auto",rc);
      }
                       /* Wait for auto mode thread to die, so we don't
                          end up with multiple copies of it later.    */

      rc = DosWaitThread(&tidAutoThread,0L);
      if (rc)
      {
         SemError("DosWaitThread",rc);
      }
      *pfAutoMode = FALSE;
      DosCloseEventSem (hevStopAuto);
  }

  /* If Auto mode haas already posted the event this is OK
     so we will not check error codes here. */

  DosPostEventSem(aSquares[rand() % MAXRESOURCES].hev);
  return;
}
开发者ID:MbqIIB,项目名称:DEV-SAMPLES-IBM_Dev_Toolkit_Samples,代码行数:49,代码来源:semaph.c

示例3: 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

示例4: 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

示例5: _PR_MD_POST_SEM

void
_PR_MD_POST_SEM(_MDSemaphore *md)
{
   int rv;
   rv = DosPostEventSem(md->sem);
   PR_ASSERT(rv == NO_ERROR); 
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.external,代码行数:7,代码来源:os2sem.c

示例6: begin_thread_helper

static void APIENTRY begin_thread_helper( thread_args *td )
/*********************************************************/
{
    thread_fn                   *rtn;
    void                        *arg;
    EXCEPTIONREGISTRATIONRECORD xcpt;
    thread_data                 *tdata;

    rtn = td->rtn;
    arg = td->argument;

    tdata = __alloca( __ThreadDataSize );
    memset( tdata, 0, __ThreadDataSize );
    // tdata->__allocated = 0;
    tdata->__data_size = __ThreadDataSize;
    if( !__Is_DLL ) {
        if( !__OS2AddThread( *_threadid, tdata ) ) return;
    }

    DosPostEventSem( td->event );
    _fpreset();
    __XCPTHANDLER = &xcpt;
    __sig_init_rtn();
    (*rtn)( arg );
    _endthread();
}
开发者ID:bhanug,项目名称:open-watcom-v2,代码行数:26,代码来源:thredo32.c

示例7: avcodec_thread_execute

int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
    ThreadContext *c= s->thread_opaque;
    int i;

    assert(s == c->avctx);
    assert(count <= s->thread_count);

    /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */

    for(i=0; i<count; i++){

        c[i].arg= (char*)arg + i*size;
        c[i].func= func;
        c[i].ret= 12345;

        DosPostEventSem(c[i].work_sem);
//        ReleaseSemaphore(c[i].work_sem, 1, 0);
    }
    for(i=0; i<count; i++){
        DosWaitEventSem(c[i].done_sem,SEM_INDEFINITE_WAIT);
//        WaitForSingleObject(c[i].done_sem, INFINITE);

        c[i].func= NULL;
        if(ret) ret[i]= c[i].ret;
    }
    return 0;
}
开发者ID:Acidburn0zzz,项目名称:ffmpeg-concat,代码行数:27,代码来源:os2thread.c

示例8: DrvMountDrivesThread

void        DrvMountDrivesThread( void * hev)

{
    ULONG       rc;
    HMODULE     hmod = 0;
    pRediscover_PRMs    pfn = 0;
    char *      pErr = 0;
    char        szErr[16];

    rc = DosLoadModule( szErr, sizeof(szErr), "LVM", &hmod);
    if (rc)
        pErr = "DosLoadModule";
    else {
        rc = DosQueryProcAddr( hmod, 0, "Rediscover_PRMs", (PFN*)&pfn);
        if (rc)
            pErr = "DosQueryProcAddr";
        else {
            pfn( &rc);
            if (rc)
                pErr = "Rediscover_PRMs";
        }
        rc = DosFreeModule( hmod);
        if (rc && !pErr)
            pErr = "DosFreeModule";
    }

    if (pErr)
        printf( "DrvMountDrivesThread - %s - rc= %lx\n", pErr, rc);

    rc = DosPostEventSem( (HEV)hev);
    if (rc)
        printf( "DrvMountDrivesThread - DosPostEventSem - rc= %lx\n", rc);

    return;
}
开发者ID:OS2World,项目名称:APP-GRAPHICS-Cameraderie,代码行数:35,代码来源:camdrive.c

示例9: WPSamFolder_wpSaveState

SOM_Scope BOOL   SOMLINK WPSamFolder_wpSaveState (WPSamF *somSelf)
{
    BOOL bRC = TRUE;

    WPSamFData *somThis = WPSamFGetData (somSelf);
    WPSamFMethodDebug ("WPSamF","WPSamFolder_wpSaveState");

    bRC &= parent_wpSaveState (somSelf);

    _ulChiffreKey = (ULONG) _wpQueryHandle (somSelf);

    bRC &= _wpSaveLong (somSelf, CLASSNAME, KEY_ZEITPUNKT2,
                        _ulZeitpunkt2 ^ (_ulChiffreKey + 0x87654321));

    bRC &= _wpSaveLong (somSelf, CLASSNAME, KEY_ZEITPUNKT1,
                        _ulZeitpunkt1 ^ (_ulChiffreKey + _ulZeitpunkt2));

    bRC &= _wpSaveLong (somSelf, CLASSNAME, KEY_FLAG, _ulFlag);

    if (bRC == FALSE)
       {
       DebugE (D_SOM, "_wpSaveState", "Failed!");
       MessageBox (IDS_SAVESTATEFAILED, MBTITLE_ERROR, MB_ENTER | MB_ERROR);
       }

    if (_wpIsCurrentDesktop (somSelf))
        {
        DosPostEventSem(hevPrfResetLock);
        DebugE (D_SOM, "_wpSaveState", "PrfReset unlocked");
        }

    return (bRC);
}
开发者ID:OS2World,项目名称:UTIL-WPS-WPSam,代码行数:33,代码来源:WPSamF.c

示例10: LoopThread

void APIENTRY LoopThread()
  {
  THREAD *pstThd = pstThread;
  CONFIG *pCfg = &pstThd->stCfg;
  THREADCTRL *pThread = &pstThd->stThread;
  int iError;
  CHAR szMessage[81];
  DCB stComDCB;

//  DosSetPriority(PRTYS_THREAD,PRTYC_FOREGROUNDSERVER,-32L,0);
  DosSetPriority(PRTYS_THREAD,PRTYC_REGULAR,-14L,0);
  while (!pThread->bStopThread)
    {
    switch (pCfg->wSimulateType)
      {
      case TERMINAL:
        GetDCB(&stIOctlInst,pstThd->hCom,&stComDCB);
        stComDCB.Flags3 &= ~F3_RTO_MASK;
        stComDCB.Flags3 |= F3_WAIT_SOMETHING;
        stComDCB.ReadTimeout = 100;
        SendDCB(&stIOctlInst,pstThd->hCom,&stComDCB);
        TerminalRead(pstThd);
        break;
      case STRING_TRANSFER:
        DoStringTransfer(pstThd);
        break;
      }
    }
  DosPostEventSem(hevKillThreadSem);
  DosExit(EXIT_THREAD,0);
  }
开发者ID:OS2World,项目名称:APP-COMM-ComScope,代码行数:31,代码来源:thread.c

示例11: _cairo_os2_surface_release_source_image

static void
_cairo_os2_surface_release_source_image (void                  *abstract_surface,
                                         cairo_image_surface_t *image,
                                         void                  *image_extra)
{
    cairo_os2_surface_t *local_os2_surface;

    local_os2_surface = (cairo_os2_surface_t *) abstract_surface;
    if ((!local_os2_surface) ||
        (local_os2_surface->base.backend != &cairo_os2_surface_backend))
    {
        /* Invalid parameter (wrong surface)! */
        return;
    }

    /* Decrease Lend counter! */
    DosRequestMutexSem (local_os2_surface->hmtx_use_private_fields, SEM_INDEFINITE_WAIT);

    if (local_os2_surface->pixel_array_lend_count > 0)
        local_os2_surface->pixel_array_lend_count--;
    DosPostEventSem (local_os2_surface->hev_pixel_array_came_back);

    DosReleaseMutexSem (local_os2_surface->hmtx_use_private_fields);
    return;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:25,代码来源:cairo-os2-surface.c

示例12: pthread_alarm

unsigned pthread_alarm(unsigned sec)
{
	int		ret = 0;
	pthread_t	self = pthread_self();

	if (sec == 0) { /* cancel pending alarm */
		self->alarm_timeout = 0;
		if (self->alarm_timer)
			DosStopTimer(self->alarm_timer);
		if (self->alarm_event)
			DosPostEventSem(self->alarm_event);
	} else
	if (sec > 0) {
		if (self->alarm_timer && self->alarm_thread) {
			DosStopTimer(self->alarm_timer);
		} else {
			DosCreateEventSem(NULL,&self->alarm_event,DC_SEM_SHARED,FALSE);
			pthread_create(&self->alarm_thread,NULL,_alarm_thread,(void *)self);
		}
		DosAsyncTimer(sec * 1000L,(HSEM)self->alarm_event,&self->alarm_timer);
		self->alarm_timeout = sec;
	} else {
		ret = EINVAL;
		errno = EINVAL;
	}
	return (ret);
}
开发者ID:OS2World,项目名称:LIB-PTHREADS,代码行数:27,代码来源:uthread_alarm.c

示例13: return

unsigned long Event::Post ( ) {

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

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

   BOOL Result = FALSE ;

   #ifdef __OS2__

      APIRET Status = DosPostEventSem ( Handle ) ;
      if ( Status && ( Status != ERROR_ALREADY_POSTED ) )
         Result = FALSE ;
      else
         Result = TRUE ;

   #else

      Result = SetEvent ( Handle ) ;

   #endif

   return ( Result ) ;

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

示例14: DARTEventFunc

LONG APIENTRY DARTEventFunc(ULONG ulStatus,
			    PMCI_MIX_BUFFER pBuffer,
			    ULONG ulFlags)
{
  if (ulFlags && MIX_WRITE_COMPLETE)
  { 

    
    pMixBufferDesc pBufDesc;

    if (pBuffer)
    {
      pBufDesc = (pMixBufferDesc) (*pBuffer).ulUserParm;

      if (pBufDesc)
      {
        SDL_AudioDevice *pSDLAudioDevice = pBufDesc->pSDLAudioDevice;
        
        pBufDesc->iBufferUsage = BUFFER_EMPTY;
        
        if (pSDLAudioDevice)
        DosPostEventSem(pSDLAudioDevice->hidden->hevAudioBufferPlayed);
      }
    }
  }
  return TRUE;
}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:27,代码来源:SDL_dart.c

示例15: Reader

void _System Reader(ULONG arg)
{
    int        data;
    ULONG      read;
    int        new_index;
    APIRET     rc;

    OverRun = FALSE;
    for( ;; ) {
        rc = DosRead( ComPort, &data, 1, &read );
        if( rc != NO_ERROR )
            break;
        if( read == 1 ) {
            new_index = ReadBuffAdd + 1;
            new_index &= BSIZE-1;
            if( new_index == ReadBuffRemove ) {
                OverRun = TRUE;
            } else {
                ReadBuff[ ReadBuffAdd ] = data;
                ReadBuffAdd = new_index;
            }
            DosPostEventSem( ReadSemaphore );
        }
    }
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:25,代码来源:seros22.c


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