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
RevLine 
[329]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
[1335]9 Copyright (c) 2006, 2008 Steven H. Levine
[329]10
11 22 Jul 06 SHL Check more run time errors
[793]12 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
[1335]13 10 Dec 08 SHL Integrate exception handler support
[329]14
15***********************************************************************/
16
[2]17#define INCL_DOS
18#define INCL_DOSERRORS
19#define INCL_WIN
[907]20#define INCL_LONGLONG // dircnrs.h
[2]21
[1188]22#include "fm3dll.h"
[1227]23#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
[1213]24#include "mainwnd.h" // Data declaration(s)
25#include "datamin.h" // Data declaration(s)
[907]26#include "fm3str.h"
27#include "errutil.h" // Dos_Error...
28#include "strutil.h" // GetPString
[1163]29#include "timer.h"
[1188]30#include "misc.h" // PostMsg
[1335]31#include "excputil.h" // xbeginthread
[2]32
[329]33static PSZ pszSrcFile = __FILE__;
34
[2]35static HEV hevTimerSem;
36
[551]37static void TimerThread(void *args)
[329]38{
[551]39 HAB hab2;
40 HMQ hmq2;
[2]41 ULONG cntr = 0;
42
43 priority_bumped();
44 hab2 = WinInitialize(0);
[551]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);
[2]62 }
63 WinDestroyMsgQueue(hmq2);
64 }
65 WinTerminate(hab2);
66 }
67}
68
[329]69//== StartTimer() return TRUE can start thread ==
[2]70
[551]71BOOL StartTimer(void)
[329]72{
[1335]73 INT rc = xbeginthread(TimerThread,
74 32768,
75 (PVOID)0,
76 pszSrcFile,
77 __LINE__);
[329]78
79 return rc != -1;
[2]80}
81
[551]82void StopTimer(void)
[329]83{
[2]84 DosPostEventSem(hevTimerSem);
85}
[793]86
87#pragma alloc_text(TIMER,TimerThread,StartTimer,StopTimer)
Note: See TracBrowser for help on using the repository browser.