source: trunk/src/winmm/os2timer.h@ 756

Last change on this file since 756 was 756, checked in by phaller, 26 years ago

Add: added timeBeginPeriod and timeEndPeriod

File size: 3.3 KB
Line 
1/* $Id: os2timer.h,v 1.4 1999-08-31 15:04:11 phaller Exp $ */
2
3#ifndef __OS2TIMER_H__
4#define __OS2TIMER_H__
5/*
6 * OS/2 Timer class
7 *
8 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
9 * Copyright 1999 Patrick Haller (phaller@gmx.net)
10 *
11 * Project Odin Software License can be found in LICENSE.TXT
12 *
13 */
14
15#ifdef _OS2WIN_H
16 #define HEV int
17 #define HTIMER int
18#endif
19
20
21/****************************************************************************
22 * Structures *
23 ****************************************************************************/
24
25#if 0
26typedef struct _MMTIMEREVENT
27{
28 struct _MMTIMEREVENT* prev;
29 struct _MMTIMEREVENT* next;
30
31 DWORD id; // event id
32 DWORD timeScheduled; // system time to fire event
33 DWORD timePeriod; // period if periodic event
34 TID tidCaller; // thread ID of caller thread
35 DWORD dwUser; // user supplied value
36 LPTIMERCALLBACK lpCallback; // address to call
37 DWORD dwFlags; // event flags
38} MMTIMEREVENT, *PMMTIMEREVENT, *LPTIMEREVENT;
39#endif
40
41/*
42 addEvent
43 removeEvent
44 rescheduleEvent
45 callbackCaller
46*/
47
48
49/****************************************************************************
50 * Class: OS2TimerResolution *
51 ****************************************************************************/
52
53class OS2TimerResolution
54{
55 public:
56 // public entries
57 static BOOL enterResolutionScope(int dwPeriod); // request timer resolution
58 static BOOL leaveResolutionScope(int dwPeriod); // release resolution request
59 static int queryCurrentResolution(); // query maximum resolution
60
61 // public variables
62 int dwPeriod;
63
64 protected:
65 // constructors and destructors
66 OS2TimerResolution(void);
67 OS2TimerResolution(int dwPeriod);
68 ~OS2TimerResolution();
69
70 // simple linked list
71 static OS2TimerResolution* sTimerResolutions; // list of resolution scoped
72 OS2TimerResolution* next; // link to next entry
73};
74
75
76/****************************************************************************
77 * Class: OS2Timer *
78 ****************************************************************************/
79
80class OS2Timer
81{
82public:
83 OS2Timer();
84 ~OS2Timer();
85
86 void TimerHandler();
87 BOOL StartTimer(int period, int resolution, LPTIMECALLBACK lptc,
88 int dwUser, int fuEvent);
89 void StopTimer();
90 void KillTimer();
91
92protected:
93
94private:
95 HEV TimerSem;
96 HTIMER TimerHandle;
97 int TimerThreadID;
98 LPTIMECALLBACK clientCallback;
99 DWORD userData;
100
101 BOOL fFatal;
102 int TimerStatus;
103 enum {
104 InActive = 0,
105 Running,
106 Stopped
107 };
108 static int timerPeriod;
109
110 // Linked list management
111 OS2Timer* next; // Next Timer
112 static OS2Timer* timers; // List of Timer
113
114};
115
116#endif
Note: See TracBrowser for help on using the repository browser.