| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | async timer thread |
David Muir to Mike Bilow (Orig: 21:32, Sun, Feb 18, 1996):
DM> a semaphore acceptable to DosStartTimer. Could you supply a
DM> working example of the use of DosStartTimer (doesn't have to do
DM> anything really except accept the semaphore being passed to it).
DM> Using DosCreateEventSem, I receive an error 323 (invalid semaphore
DM> handle).
Cast your HEV semaphore to HSEM when calling DosStartTimer.
#define INCL_DOS
#include
HEV ESem;
HTIMER Timer;
ULONG AlarmTime, j;
APIRET rc;
USHORT i;
int main(int argc, void *argv[])
{
AlarmTime = 5000;
DosCreateEventSem(NULL, &ESem, DC_SEM_SHARED, 0);
rc = DosStartTimer(AlarmTime, (HSEM)ESem, &Timer);
>-Typecasting here will fix it---^^^^^^
if (rc) printf("DosStartTimer failed. RC = %ld\n", rc);
j = 0;
for (i=0; i < 6; i++)
{
DosWaitEventSem(ESem, SEM_INDEFINITE_WAIT);
DosResetEventSem(ESem, &j);
for (; j > 0; j--)
DosBeep(1300, 0500);
}
DosStopTimer(Timer);
return 0;
}
GeeCee/2
gchambers{at}maine.com
... Topsham, ME 43 57.0'N 69 57.0'W
---
* Origin: Mystic Seaport Inn OiS/2 - USR DS V.34+ - (207)721-3258 (1:326/426)SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955 SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809 @PATH: 326/426 411 400 3615/50 396/1 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.