當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。