source: trunk/dll/timer.c@ 2

Last change on this file since 2 was 2, checked in by root, 23 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
RevLine 
[2]1#define INCL_DOS
2#define INCL_DOSERRORS
3#define INCL_WIN
4
5#include <os2.h>
6#include <stdarg.h>
7#include <stdio.h>
8#include <stdlib.h>
9#include <string.h>
10#include "fm3dll.h"
11#include "fm3str.h"
12
13#pragma alloc_text(TIMER,TimerThread,StartTimer,StopTimer)
14
15static HEV hevTimerSem;
16
17
18static void TimerThread (void *args) {
19
20 HAB hab2;
21 HMQ hmq2;
22 ULONG cntr = 0;
23
24 priority_bumped();
25 hab2 = WinInitialize(0);
26 if(hab2) {
27 hmq2 = WinCreateMsgQueue(hab2,
28 0);
29 if(hmq2) {
30 WinCancelShutdown(hmq2,
31 TRUE);
32 if(!DosCreateEventSem(NULL,
33 &hevTimerSem,
34 0,
35 FALSE)) {
36 for(;;) {
37 if(DosWaitEventSem(hevTimerSem,
38 3000) !=
39 ERROR_TIMEOUT)
40 break;
41 cntr++;
42 if(hwndTree &&
43 !(cntr % 3))
44 PostMsg(hwndTree,
45 UM_TIMER,
46 MPVOID,
47 MPVOID);
48 if(hwndBubble &&
49 WinIsWindowVisible(hwndBubble))
50 PostMsg(hwndBubble,
51 UM_TIMER,
52 MPVOID,
53 MPVOID);
54 if(DataHwnd)
55 PostMsg(DataHwnd,
56 UM_TIMER,
57 MPVOID,
58 MPVOID);
59 }
60 DosCloseEventSem(hevTimerSem);
61 }
62 WinDestroyMsgQueue(hmq2);
63 }
64 WinTerminate(hab2);
65 }
66}
67
68BOOL StartTimer (void) {
69
70 return (_beginthread(TimerThread,
71 NULL,
72 32768,
73 (PVOID)0) != -1);
74}
75
76void StopTimer (void) {
77
78 DosPostEventSem(hevTimerSem);
79}
80
Note: See TracBrowser for help on using the repository browser.