source: trunk/dll/timer.c@ 1880

Last change on this file since 1880 was 1880, checked in by Gregg Young, 10 years ago

Remove dead code and comments from remaining c files. #if 0 and #if NEVER were not addressed

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1
2/***********************************************************************
3
4 $Id: timer.c 1880 2015-10-12 18:26:16Z gyoung $
5
6 Timer thread
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2006, 2008 Steven H. Levine
10
11 22 Jul 06 SHL Check more run time errors
12 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
13 10 Dec 08 SHL Integrate exception handler support
14
15***********************************************************************/
16
17#define INCL_DOS
18#define INCL_DOSERRORS
19#define INCL_WIN
20#define INCL_LONGLONG // dircnrs.h
21
22#include "fm3dll.h"
23#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
24#include "mainwnd.h" // Data declaration(s)
25#include "datamin.h" // Data declaration(s)
26#include "fm3str.h"
27#include "errutil.h" // Dos_Error...
28#include "strutil.h" // GetPString
29#include "timer.h"
30#include "misc.h" // PostMsg
31#include "excputil.h" // xbeginthread
32
33static PSZ pszSrcFile = __FILE__;
34
35static HEV hevTimerSem;
36
37static void TimerThread(void *args)
38{
39 HAB hab2;
40 HMQ hmq2;
41 ULONG cntr = 0;
42
43 priority_bumped();
44 hab2 = WinInitialize(0);
45 if (hab2) {
46 hmq2 = WinCreateMsgQueue(hab2, 0);
47 if (hmq2) {
48 WinCancelShutdown(hmq2, TRUE);
49 if (!DosCreateEventSem(NULL, &hevTimerSem, 0, FALSE)) {
50 for (;;) {
51 if (DosWaitEventSem(hevTimerSem, 3000) != ERROR_TIMEOUT)
52 break;
53 cntr++;
54 if (hwndTree && !(cntr % 3))
55 PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID);
56 if (hwndBubble && WinIsWindowVisible(hwndBubble))
57 PostMsg(hwndBubble, UM_TIMER, MPVOID, MPVOID);
58 if (DataHwnd)
59 PostMsg(DataHwnd, UM_TIMER, MPVOID, MPVOID);
60 }
61 DosCloseEventSem(hevTimerSem);
62 }
63 WinDestroyMsgQueue(hmq2);
64 }
65 WinTerminate(hab2);
66 }
67}
68
69//== StartTimer() return TRUE can start thread ==
70
71BOOL StartTimer(void)
72{
73 INT rc = xbeginthread(TimerThread,
74 32768,
75 (PVOID)0,
76 pszSrcFile,
77 __LINE__);
78
79 return rc != -1;
80}
81
82void StopTimer(void)
83{
84 DosPostEventSem(hevTimerSem);
85}
86
87#pragma alloc_text(TIMER,TimerThread,StartTimer,StopTimer)
Note: See TracBrowser for help on using the repository browser.