Changeset 14922


Ignore:
Timestamp:
Oct 1, 2000, 11:16:29 PM (25 years ago)
Author:
phaller
Message:

Fix for timers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tags/trunk/src/winmm/os2timer.cpp

    r14177 r14922  
    1 /* $Id: os2timer.cpp,v 1.15 2000-05-24 01:56:25 phaller Exp $ */
     1/* $Id: os2timer.cpp,v 1.16 2000-10-01 21:16:29 phaller Exp $ */
    22
    33/*
     
    4444{
    4545  typedef DWORD (* CALLBACK LPTHREAD_START_ROUTINE)(LPVOID);
    46 
     46 
     47  DWORD WIN32API GetLastError();
     48 
    4749  HANDLE WIN32API CreateThread(LPSECURITY_ATTRIBUTES lpsa,
    4850                               DWORD cbStack,
     
    268270    timers = this;
    269271 
     272  // create timer semaphore
     273  int rc = DosCreateEventSem(NULL, &TimerSem, DC_SEM_SHARED, 0);
     274  if(rc != 0)
     275  {
     276    dprintf(("WINMM: OS2Timer: DosCreateEventSem failed rc=#%08xh\n", rc));
     277    return; // terminate thread
     278  }
     279 
     280 
    270281  //hTimerThread = _beginthread(TimerHlpHandler, NULL, 0x4000, (void *)this);
    271282  hTimerThread = CreateThread(NULL,
     
    275286                              0, // thread creation flags
    276287                              &TimerThreadID);
    277 
    278   //@@@PH: CreateThread() should be used instead
    279   //@@@PH: logic sux ... waits for creation of semaphores
    280   DosSleep(10);
     288 
     289  if (hTimerThread == NULL)
     290  {
     291    dprintf(("WINMM: OS2Timer: CreateThread failed rc=#%08xh\n",
     292             GetLastError()));
     293    DosCloseEventSem(TimerSem);
     294  }
    281295}
    282296/******************************************************************************/
     
    402416                       0L);                 /* Assume current thread  */
    403417
    404   rc = DosCreateEventSem(NULL, &TimerSem, DC_SEM_SHARED, 0);
    405   if(rc != 0)
    406   {
    407     dprintf(("WINMM: OS2Timer: DosCreateEventSem failed rc=#%08xh\n", rc));
    408     return; // terminate thread
    409   }
    410 
    411418  TimerStatus = Stopped;
    412419
    413420  while(!fFatal)
    414421  {
     422    dprintf(("WINMM: OS2Timer::TimerHandler waiting on timer (%04xh, %08xh\n",
     423             dwFlags,
     424            clientCallback));
     425   
    415426    DosWaitEventSem(TimerSem, SEM_INDEFINITE_WAIT);
    416427    DosResetEventSem(TimerSem, &Count);
     
    423434        if (TimerStatus == Running)
    424435        {
     436          dprintf(("WINMM: OS2Timer::TimerHandler firing (%04xh, %08xh\n",
     437                   dwFlags,
     438                  clientCallback));
     439         
    425440          // process the event
    426441          switch (dwFlags & 0x0030)
Note: See TracChangeset for help on using the changeset viewer.