| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | OS/2 programming tips ??? |
DE> Unfortunatly, the program can be called in the startup routine and would
DE> most likely be in use until either shutdown or
DE> powerdown. This means that the semaphore might be left
DE> on disk
OS/2 Semaphores are not files. Mike's suggestion (to use a sem to check
for a running instance) is the best one.
DE> 3) Are you allowed to use the 1ch timer in OS/2? If not, how
DE> can you synchronize timed events to the tic counter?
What's a tic counter? (Just kidding). Under OS/2, you need not stoop to
such gimicks. There are many ways to pass time (DosSleep), be woken up
periodically (DosStartTimer), or to synchronize with other
threads/programs (DosWaitEventSem). The APIs shown in brackets are just a
starting point...
MB> Maybe you would get better answers if you backed up a
MB> bit and explained in more broad terms what it is that
MB> you want to do.
DE> Well, I need something more reliable in order to more reliably simulate
DE> real-time operation (which I hear is a failing with
DE> OS/2). Interrupt driven is probably a key word here.
You didn't back up far enough. What are you trying to do (what type of
device are you reading (if any), how often, and how much data)?
OS/2 is just fine for "real time", as long as the
"time" is in the mSec range, not uSec.
void OS2Reboot (void)
{
HFILE hf;
ULONG dummy;
ULONG rc;
rc = DosOpen("DOS$", &hf, &dummy, 0L, FILE_NORMAL, FILE_OPEN,
OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYNONE |
OPEN_FLAGS_FAIL_ON_ERROR, NULL);
if(!rc)
{
printf ("\nShutdown...");
rc = DosShutdown(0L); // shut down file systems.
if (rc) ErrorProc(rc);
/* 32-Bit reboot */
DosDevIOCtl( hf, 0xd5, 0xab, NULL, 0, NULL, NULL, 0, NULL );
/* old 16-bit reboot
DosDevIOCtl(NULL, NULL, 0xab, 0xd5, hf);
*/
DosClose(hf);
}
else
printf ("\nDOS.SYS not installed. Can't Reboot.");
}
--- Maximus/2 2.02p1
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 259/414 400 99 250/702 3615/50 396/1 270/101 105/103 42 712/515 @PATH: 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™.