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


C++ DosSleep函数代码示例

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


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

示例1: aboutProcR

MRESULT EXPENTRY aboutProcR( HWND hwndDlg, ULONG msg,
			    MPARAM mp1, MPARAM mp2 )
{
INT i;
switch ( msg )
   {
   case WM_INITDLG:
      return WinDefDlgProc( hwndDlg, msg, mp1, mp2 );

   case WM_COMMAND:
      switch( SHORT1FROMMP( mp1 ) )
	 {
	 case DID_CANCEL :
	    WinShowWindow(WinWindowFromID(hwndDlg, DID_CANCEL), FALSE);
	    for( i=0;i<4;i++ )
	       {
	       WinShowWindow(WinWindowFromID(hwndDlg, ID_BEGSCREEN), FALSE);
	       DosSleep(200);
	       WinShowWindow(WinWindowFromID(hwndDlg, ID_BEGSCREEN), TRUE);
	       DosSleep(200);
	       }
	    WinDismissDlg( hwndDlg, TRUE );
	    break;

	 default :
	    return WinDefDlgProc( hwndDlg, msg, mp1, mp2 );
	 }
      break;
   default :
      return WinDefDlgProc( hwndDlg, msg, mp1, mp2 );
   }
return (MRESULT) FALSE;
}
开发者ID:OS2World,项目名称:APP-DATABASE-Datapad,代码行数:33,代码来源:about.c

示例2: alarm_thread

static VOID FAR alarm_thread ( VOID )
{
    while(1)
    {
      if (bAlarmRunning)
      {
        DosSleep(1000L);
        uTime--;
        if (uTime==0L)
        {
          // send signal to the main process.. I could have put raise() here
          // however that would require the use of the multithreaded library,
          // and it does not contain raise()!
          // I tried it with the standard library, this signaled ok, but a
          // test printf in the signal would not work and even caused SEGV.
          // So I signal the process through OS/2 and then the process
          // signals itself.
          if (bAlarmRunning)
            DosFlagProcess(pidMain,FLGP_PID, PFLG_A,1);
          bAlarmRunning=FALSE;
        }
      }
      else
        DosSleep(500L);
    }
}
开发者ID:Kiddinglife,项目名称:4.4BSD-Lite,代码行数:26,代码来源:alarm.c

示例3: main

void main(int argc, char **argv)
{
   APIRET rc;
   ULONG ulAction = 0;
   TID tid = 0;
   char szTemp[] = "NPU4011$";
   char szDevName[128] = "\\DEV\\";

   if (argc > 1) {
      strcpy(szTemp, argv[1]);
      szTemp[0]++;
   }

   strcat(szDevName, szTemp);

   printf("MPUTRACE - Theta Band Software MPU-401 Driver Trace Utility\n");
   printf("%d Trace Messages supported\n", NUM_TRACES);
   printf("Opening %s\n", szDevName);
   rc = DosOpen((PSZ) szDevName, &hfile, &ulAction, 0, 0, OPEN_FLAG, OPEN_MODE, NULL);
   if (rc) {
      printf("Error %d while trying to open MPU-401 device driver\n", rc);
      return;
   }

   ULONG ulSize1;
   ULONG ulSize2 = sizeof(STATUS);
   rc = DosDevIOCtl(hfile, 0x80, 0, NULL, ulSize1, &ulSize1, &status, ulSize2, &ulSize2);
   if (rc) {
      printf("Error %d while trying to get MPU-401 status\n", rc);
      return;
   }

   PrintStatus();

   printf("Creating thread\n");
   rc = DosCreateThread(&tid, (PFNTHREAD) Thread, 0, CREATE_READY | STACK_COMMITTED, 8192);
   if (rc) {
      printf("DosCreateThread failed with RC = %lu\n", rc);
      return;
   }

   while (!fRunning)
      DosSleep(100);

   printf("Hit any key to quit. Program will then exit after the next message.\n");

   getch();
   printf("Quitting ...\n");
   fQuit = TRUE;
   while (fRunning)
      DosSleep(100);

   DosSleep(500);    // wait until the thread really ends
   DosClose(hfile);
}
开发者ID:OS2World,项目名称:DRV-MPU-401,代码行数:55,代码来源:mputrace.cpp

示例4: poplog

// poplog( )
//
//  Open the popuplog and sent to printsys( )
//
void poplog(struct PROGRAMOPTS *prgoptions)
{
    int start = 1;

    char buffer[256];

    FILE *popfile;

    if(access(prgoptions->popupfile, F_OK) == 0)
    {
        popfile = fopen(prgoptions->popupfile, "rt");

        while(!feof(popfile))
        {
            fgets(buffer, 256, popfile);

            if(start == 1)
            {
                printsys(" --< START POPUPLOG ENTRY >-- ");
                start = 0;
            }

            if((int)buffer[0] == 45)
            {
                printsys(" --<  END POPUPLOG ENTRY  >-- ");
                start = 1;
            }
            else if((int)buffer[0] != 0) printsys( buffer );
            DosSleep(20L);
        }

        printsys(" --<  END POPUPLOG ENTRY  >-- ");

        fclose(popfile);

        remove(prgoptions->popupfile);
    }

    if(access(prgoptions->flashlog, F_OK) == 0)
    {
        popfile = fopen(prgoptions->flashlog, "rt");

        while(!feof(popfile))
        {
            fgets(buffer, 256, popfile);
            printsys( buffer );
            DosSleep(20L);
        }

        fclose(popfile);

        remove(prgoptions->flashlog);
    }
}
开发者ID:OS2World,项目名称:UTIL-SYSTEM-SysLogd,代码行数:58,代码来源:syslogpop.c

示例5: StdLib_Retard

VOID StdLib_Retard( VOID )
{
 // Ждем некоторое время.
 #ifdef I386_ARCHITECTURE
  DosSleep( 50 );
 #else
  DosSleep( 10 );
 #endif

 // Возврат.
 return;
}
开发者ID:OS2World,项目名称:UTIL-WPS-Nice_OS2_Enhancer,代码行数:12,代码来源:StdLib_code.cpp

示例6: priority

/*
	priority_thread
	This thread controls the priority of the drawing thread.
	With these changes, if a saver module runs on low priority (this is
	the default setting), it rises to normal priority twice a second
	for 0.1 seconds. This should solve the problem that, when very
	time-consuming processes were running, the module seemed not to become
	active at all (in fact it became active, but did not get enough CPU
	time to do its saver action).
	There should be no reason to alter the code.
*/
void	priority_thread(void *args)
{
	DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 0, 0);
	for(;!stop_priority_thread;){
		int	i;
		DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, 0, tidDraw);
		DosSleep(100);
		DosSetPriority(PRTYS_THREAD, PRTYC_IDLETIME, 0, tidDraw);
		for(i=0;!stop_priority_thread && i<4;i++)
			DosSleep(100);
	}
}
开发者ID:NicoleRauch,项目名称:ScreenSaverModules,代码行数:23,代码来源:bounce.c

示例7: PostListens

static void PostListens( void )
{
    int         i;

    DosSleep( 0 );
    for( i = NUM_REC_BUFFS-1; i >= 0; --i ) {
        if( !InUse( RecECB[i] ) ) {
            PostAListen( i );
        }
    }
    /* make sure other side get the listens up */
    DosSleep( 100 );
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:13,代码来源:novos2.c

示例8: DosSleep

void omni_thread::sleep(unsigned long secs, unsigned long nanosecs)
{
    if (secs <= MAX_SLEEP_SECONDS) {
    DosSleep(secs * 1000 + nanosecs / 1000000);
    return;
    }

    ULONG no_of_max_sleeps = secs / MAX_SLEEP_SECONDS;

    for (ULONG i = 0; i < no_of_max_sleeps; i++)
    DosSleep(MAX_SLEEP_SECONDS * 1000);

    DosSleep((secs % MAX_SLEEP_SECONDS) * 1000 + nanosecs / 1000000);
}
开发者ID:OS2World,项目名称:APP-INTERNET-PMVNC-Server,代码行数:14,代码来源:os2.cpp

示例9: system_End

/**
 * Cleans up after system_Init() and system_Configure().
 */
void system_End(void)
{
    if( tidIPCFirst == _gettid())
    {
        HPIPE hpipe;
        ULONG ulAction;
        ULONG cbActual;
        ULONG rc;

        do
        {
            rc = DosOpen( VLC_IPC_PIPE, &hpipe, &ulAction, 0, 0,
                          OPEN_ACTION_OPEN_IF_EXISTS,
                          OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYREADWRITE |
                          OPEN_FLAGS_FAIL_ON_ERROR,
                          NULL );

            if( rc == ERROR_PIPE_BUSY )
                DosWaitNPipe( VLC_IPC_PIPE, -1 );
            else if( rc )
                DosSleep( 1 );
        } while( rc );

        /* Ask for IPCHelper to quit */
        ULONG ulCmd = IPC_CMD_QUIT;
        DosWrite( hpipe, &ulCmd, sizeof( ulCmd ), &cbActual );

        DosClose( hpipe );

        TID tid = tidIPCHelper;
        DosWaitThread( &tid, DCWW_WAIT );
    }
}
开发者ID:etix,项目名称:vlc,代码行数:36,代码来源:specific.c

示例10: RTDECL

RTDECL(int)   RTThreadSleep(RTMSINTERVAL cMillies)
{
    LogFlow(("RTThreadSleep: cMillies=%d\n", cMillies));
    DosSleep(cMillies);
    LogFlow(("RTThreadSleep: returning (cMillies=%d)\n", cMillies));
    return VINF_SUCCESS;
}
开发者ID:stefano-garzarella,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:7,代码来源:thread-os2.cpp

示例11: RemoteDisco

void RemoteDisco( void )
{
    int         i;

    DosSleep( 500 );    /* make sure last packet gets sent */
    Listening = 0;
    _INITSPXECB( Conn, 1, 0, 0 );
    if( SpxTerminateConnection( Connection, &ConnECB ) == 0 ) {
        while( InUse( ConnECB ) ) IPXRelinquishControl();
    }
    for( i = NUM_REC_BUFFS-1; i >= 0; --i ) {
        if( InUse( RecECB[i] ) ) {
            SpxCancelPacket( &RecECB[i] );
        }
    }
    if( InUse( SendECB ) ) {
        SpxCancelPacket( &SendECB );
    }
    for( i = NUM_REC_BUFFS-1; i >= 0; --i ) {
        ZeroArray( RecHead[i] );
        ZeroArray( RecECB[i] );
    }
    ZeroArray( ConnHead );
    ZeroArray( SendHead );
    ZeroArray( ConnECB );
    ZeroArray( SendECB );
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:27,代码来源:novos2.c

示例12: Eingang

void Eingang()
{
	DosBeep(3000,300);
	DosSleep(1000);
	DosBeep(4000,200);
	DosExit(0,0);
}
开发者ID:GYGit,项目名称:reactos,代码行数:7,代码来源:bepslep.c

示例13: WaitForSlip

static void WaitForSlip(void) {

    int FirstTime = 1;
    APIRET rc;
    short Seconds = Timeout;
    do {
        rc = DosOpenEventSem("\\sem32\\slip\\monitor", &slip_running);
        if (rc) {
            if (FirstTime) {
                printf("[ Waiting for SLIP - maximum wait = %d seconds ]\n",
                       Timeout);
                FirstTime = 0;
            }
            Seconds--;
            if (Seconds >= 0) {
                if (Debug) {
                    fprintf(stderr, ".");
                    fflush(stderr);
                }
                DosSleep(1000L);
            }
        }
    } while (rc && (Seconds >= 0));
    if (Debug) {
        fprintf(stderr, "\n");
    }
    if (Seconds < 0) {
        printf("The SLIP driver appears not to have started.\n");
        exit(1);
    }
}						// WaitForSlip()
开发者ID:OS2World,项目名称:APP-INTERNET-SlipFree,代码行数:31,代码来源:SlipFree.cpp

示例14: RunThreadsOn

/*
===============
RunThreadsOn
===============
*/
void RunThreadsOn (threadfunc_t func)
{
	LONG		i;

	if (numthreads <= 1)
	{
		work_threads[0] = -1;
		func (NULL);
		return;
	}

	workfunc = func;

	for (i = 0; i < numthreads; i++)
	{
		work_threads[i] = _beginthread(ThreadWorkerFunc, NULL, stacksiz, (void *)i);
		if (work_threads[i] == -1)
			COM_Error ("_beginthread() failed");
	}

	for (i = 0; i < numthreads; i++)
	{
		while (work_threads[i] != -1)
			DosSleep (100);
	}
}
开发者ID:svn2github,项目名称:uhexen2,代码行数:31,代码来源:threads.c

示例15: hb_taskFreeze

static void hb_taskFreeze( HB_MAXINT wakeup )
{
#if defined( HB_OS_DOS )
   while( wakeup > hb_taskTimeStop( 0 ) )
   {
      union REGS regs;

      regs.h.ah = 2;
      regs.HB_XREGS.ax = 0x1680;

      HB_DOS_INT86( 0x2F, &regs, &regs );
   }
#else
   wakeup -= hb_taskTimeStop( 0 );
   if( wakeup > 0 )
   {
#  if defined( __DJGPP__ )
      usleep( wakeup * 1000 );
#  elif defined( HB_OS_WIN )
      Sleep( wakeup );
#  elif defined( HB_OS_OS2 )
      DosSleep( wakeup );     /* Duration is in milliseconds */
#  elif defined( HB_OS_UNIX )
      struct timeval tv;
      tv.tv_sec = wakeup / 1000;
      tv.tv_usec = ( wakeup % 1000 ) * 1000;
      select( 0, NULL, NULL, NULL, &tv );
#  endif
   }
#endif
}
开发者ID:JamesLinus,项目名称:core,代码行数:31,代码来源:task.c


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