Changeset 668


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

Fix: added SetWin32TIB wrappers to callback functions

Location:
trunk/src/winmm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/winmm/dwaveout.cpp

    r588 r668  
    1 /* $Id: dwaveout.cpp,v 1.5 1999-08-19 18:46:04 phaller Exp $ */
     1/* $Id: dwaveout.cpp,v 1.6 1999-08-24 21:21:11 phaller Exp $ */
    22
    33/*
     
    1616 ****************************************************************************/
    1717
     18
     19
    1820#define  INCL_BASE
    1921#define  INCL_OS2MM
     
    2224#include <stdlib.h>
    2325#include <string.h>
    24 
    2526#define  OS2_ONLY
    2627#include "win32type.h"
     28#include <wprocess.h>
    2729
    2830#include "misc.h"
     
    4850   Init(pwfx);
    4951
    50    callback         = (LPDRVCALLBACK)nCallback;
     52   mthdCallback         = (LPDRVCALLBACK)nCallback;
    5153   this->dwInstance = dwInstance;
    5254
     
    6264
    6365   WinPostMsg(hwndCallback, WOM_OPEN, 0, 0);
     66}
     67/******************************************************************************/
     68/******************************************************************************/
     69void DartWaveOut::callback(HDRVR h, UINT uMessage, DWORD dwUser, DWORD dw1, DWORD dw2)
     70{
     71  USHORT selTIB = SetWin32TIB();
     72  mthdCallback(h,uMessage,dwUser,dw1,dw2);
     73  SetFS(selTIB);
    6474}
    6575/******************************************************************************/
     
    7787   wavehdr       = NULL;
    7888   curhdr        = NULL;
    79    callback      = NULL;
     89   mthdCallback  = NULL;
    8090   hwndCallback  = 0;
    8191   dwInstance    = 0;
  • TabularUnified trunk/src/winmm/dwaveout.h

    r95 r668  
    1 /* $Id: dwaveout.h,v 1.3 1999-06-10 16:24:33 phaller Exp $ */
     1/* $Id: dwaveout.h,v 1.4 1999-08-24 21:21:11 phaller Exp $ */
    22
    33/*
     
    7171    int curFillPos, curPlayPos; //fillpos == pos in os2 mix buffer, bufpos == pos in win buffer
    7272
    73  LPDRVCALLBACK callback;
     73  // callback interface
     74  LPDRVCALLBACK mthdCallback;
     75  void          callback(HDRVR h, UINT uMessage, DWORD dwUser, DWORD dw1, DWORD dw2);
     76
    7477         HWND hwndCallback;
    7578        DWORD dwInstance;
  • TabularUnified trunk/src/winmm/midi.cpp

    r588 r668  
    1 /* $Id: midi.cpp,v 1.4 1999-08-19 18:46:04 phaller Exp $ */
     1/* $Id: midi.cpp,v 1.5 1999-08-24 21:21:11 phaller Exp $ */
    22
    33/*
     
    2626#include "midi.hpp"
    2727#include <winos2def.h>
    28 
     28#include <wprocess.h>
    2929
    3030ODINDEBUGCHANNEL(WINMM-MIDI)
     
    884884void Midi::callback( UINT msg, DWORD p1, DWORD p2)
    885885{
     886  USHORT selTIB;
     887
     888  dprintf(("WINMM: callback %x %lx %lx\n", msg, p1, p2 ));
     889
    886890   if ( iCallbackFunction )
    887891   {
    888       dprintf(("WINMM: callback %x %lx %lx\n", msg, p1, p2 ));
    889       iCallbackFunction( (ULONG)this, msg, iCallbackInstance, p1, p2 );
     892     selTIB = SetWin32TIB();
     893     iCallbackFunction( (ULONG)this, msg, iCallbackInstance, p1, p2 );
     894     SetFS(selTIB);
    890895   }
    891896   else
     
    969974   // Disable the link
    970975   iHwdInstance->removeLink( iAppInstance );
    971 
    972976   callback( MIM_CLOSE, 0, 0 );
    973977   return MMSYSERR_NOERROR;
  • TabularUnified 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.