Last change
on this file since 329 was 329, checked in by root, 19 years ago |
Check more run time errors
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
2.1 KB
|
Line | |
---|
1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: timer.c 329 2006-07-25 18:39:11Z root $
|
---|
5 |
|
---|
6 | Timer thread
|
---|
7 |
|
---|
8 | Copyright (c) 1993-98 M. Kimes
|
---|
9 | Copyright (c) 2006 Steven H. Levine
|
---|
10 |
|
---|
11 | 22 Jul 06 SHL Check more run time errors
|
---|
12 |
|
---|
13 | ***********************************************************************/
|
---|
14 |
|
---|
15 | #define INCL_DOS
|
---|
16 | #define INCL_DOSERRORS
|
---|
17 | #define INCL_WIN
|
---|
18 | #include <os2.h>
|
---|
19 |
|
---|
20 | #include <stdarg.h>
|
---|
21 | #include <stdio.h>
|
---|
22 | #include <stdlib.h>
|
---|
23 | #include <string.h>
|
---|
24 |
|
---|
25 | #include "fm3dll.h"
|
---|
26 | #include "fm3str.h"
|
---|
27 |
|
---|
28 | #pragma alloc_text(TIMER,TimerThread,StartTimer,StopTimer)
|
---|
29 |
|
---|
30 | static PSZ pszSrcFile = __FILE__;
|
---|
31 |
|
---|
32 | static HEV hevTimerSem;
|
---|
33 |
|
---|
34 | static void TimerThread (void *args)
|
---|
35 | {
|
---|
36 | HAB hab2;
|
---|
37 | HMQ hmq2;
|
---|
38 | ULONG cntr = 0;
|
---|
39 |
|
---|
40 | priority_bumped();
|
---|
41 | hab2 = WinInitialize(0);
|
---|
42 | if(hab2) {
|
---|
43 | hmq2 = WinCreateMsgQueue(hab2,
|
---|
44 | 0);
|
---|
45 | if(hmq2) {
|
---|
46 | WinCancelShutdown(hmq2,
|
---|
47 | TRUE);
|
---|
48 | if(!DosCreateEventSem(NULL,
|
---|
49 | &hevTimerSem,
|
---|
50 | 0,
|
---|
51 | FALSE)) {
|
---|
52 | for(;;) {
|
---|
53 | if(DosWaitEventSem(hevTimerSem,
|
---|
54 | 3000) !=
|
---|
55 | ERROR_TIMEOUT)
|
---|
56 | break;
|
---|
57 | cntr++;
|
---|
58 | if(hwndTree &&
|
---|
59 | !(cntr % 3))
|
---|
60 | PostMsg(hwndTree,
|
---|
61 | UM_TIMER,
|
---|
62 | MPVOID,
|
---|
63 | MPVOID);
|
---|
64 | if(hwndBubble &&
|
---|
65 | WinIsWindowVisible(hwndBubble))
|
---|
66 | PostMsg(hwndBubble,
|
---|
67 | UM_TIMER,
|
---|
68 | MPVOID,
|
---|
69 | MPVOID);
|
---|
70 | if(DataHwnd)
|
---|
71 | PostMsg(DataHwnd,
|
---|
72 | UM_TIMER,
|
---|
73 | MPVOID,
|
---|
74 | MPVOID);
|
---|
75 | }
|
---|
76 | DosCloseEventSem(hevTimerSem);
|
---|
77 | }
|
---|
78 | WinDestroyMsgQueue(hmq2);
|
---|
79 | }
|
---|
80 | WinTerminate(hab2);
|
---|
81 | }
|
---|
82 | }
|
---|
83 |
|
---|
84 | //== StartTimer() return TRUE can start thread ==
|
---|
85 |
|
---|
86 | BOOL StartTimer (void)
|
---|
87 | {
|
---|
88 | INT rc = _beginthread(TimerThread,NULL,32768,(PVOID)0);
|
---|
89 |
|
---|
90 | if (rc == -1)
|
---|
91 | Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
92 |
|
---|
93 | return rc != -1;
|
---|
94 | }
|
---|
95 |
|
---|
96 | void StopTimer (void)
|
---|
97 | {
|
---|
98 | DosPostEventSem(hevTimerSem);
|
---|
99 | }
|
---|
100 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.