Ignore:
Timestamp:
Aug 24, 1999, 11:21:11 PM (26 years ago)
Author:
phaller
Message:

Fix: added SetWin32TIB wrappers to callback functions

File:
1 edited

Legend:

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

    r663 r668  
    1 /* $Id: os2timer.cpp,v 1.6 1999-08-24 16:12:04 phaller Exp $ */
     1/* $Id: os2timer.cpp,v 1.7 1999-08-24 21:21:11 phaller Exp $ */
    22
    33/*
     
    2222#include "win32type.h"
    2323#include "wintimer.h"
     24#include <wprocess.h>
    2425#include "os2timer.h"
    2526#include "misc.h"
     
    163164void OS2Timer::TimerHandler()
    164165{
    165  ULONG   Count = 0;
    166  APIRET  rc = 0;       /* Return code  */
    167 
    168 #ifdef DEBUG
    169     WriteLog("TimerHandler thread created\n");
    170 #endif
    171     rc = DosSetPriority (PRTYS_THREAD,        /* Change a single thread */
    172                          PRTYC_TIMECRITICAL,  /* Time critical class    */
    173                          0L,                  /* Increase by 15         */
    174                          0L);                 /* Assume current thread  */
    175 
    176     rc = DosCreateEventSem(NULL, &TimerSem, DC_SEM_SHARED, 0);
    177 
    178     if(rc != 0)
    179         _endthread();
    180 
    181 #ifdef DEBUG
    182     WriteLog("Semaphore created\n");
    183 #endif
    184     TimerStatus = Stopped;
    185 
    186     while(!fFatal) {
    187         DosWaitEventSem(TimerSem, SEM_INDEFINITE_WAIT);
    188         DosResetEventSem(TimerSem, &Count);
    189         if(!fFatal) {
    190 #ifdef DEBUG
    191 ////        WriteLog("T");
    192 #endif
     166  ULONG   Count = 0;
     167  APIRET  rc = 0;       /* Return code  */
     168  USHORT  selTIB;
     169
     170  dprintf(("WINMM: TimerHandler thread created\n"));
     171
     172  rc = DosSetPriority (PRTYS_THREAD,        /* Change a single thread */
     173                       PRTYC_TIMECRITICAL,  /* Time critical class    */
     174                       0L,                  /* Increase by 15         */
     175                       0L);                 /* Assume current thread  */
     176
     177  rc = DosCreateEventSem(NULL, &TimerSem, DC_SEM_SHARED, 0);
     178
     179  if(rc != 0)
     180      _endthread();
     181
     182  dprintf(("WINMM: OS2Timer:Semaphore created\n"));
     183
     184  TimerStatus = Stopped;
     185
     186  while(!fFatal)
     187  {
     188    DosWaitEventSem(TimerSem, SEM_INDEFINITE_WAIT);
     189    DosResetEventSem(TimerSem, &Count);
     190    if(!fFatal)
     191    {
    193192        // @@@PH: we're calling the client with PRTYC_TIMECRITICAL !!!
    194193        //        It'd be much nicer to call with original priority!
     
    196195        //        time event is scheduled (DosSuspendThread()) ? It's
    197196        //        much like raising a signal (SIGALARM)
     197
     198        selTIB = SetWin32TIB();
    198199        clientCallback((UINT)this, 0, userData, 0, 0);
    199     }
    200     }
    201     DosCloseEventSem(TimerSem);
     200        SetFS(selTIB);
     201    }
     202  }
     203  DosCloseEventSem(TimerSem);
    202204}
    203205//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.