| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | OS/2 Shutdown |
Am 16.01.97 schrieb Vitus Jensen{at}2:2474/400.8
in der OS2PROG folgendes an Stephan Zerth:
VJ> Moin Stephan,
Moin Vitus,
VJ> What kind of a program was this application? A VIO program I coded was
PM- and VIO's
VJ> still running when this "shudown completed" box appeared. I added a
VJ> thread to beep regularly to detect the moment of program exit and it was
VJ> still beeping (until I flipped the big red switch ;-).
I think you made a slight mistake in your test program. Execution control
is given to thread 1 in case of process termination. All other threads will
be terminated and stack will be reset by the OS. If your "beeping" thread
was in "beeping state" when terminated, it beeps forever... ;-))
SZ>> BTW: ShutDown will _never_ complete, until exitlist-processing of
SZ>> _all_ processes is complete.
VJ> This is certainly not true for VIO programs. I switched to a PM program
This _is_ true. I'll supply some sample code for you wich _will_ work as an
VIO process. It will return the OS-defined values for exiting or termination
by kill _or shutdown!_ You may want to examine...
VJ> to get a WM_CLOSE message and this is AFAIK the only possibility to detect
VJ> a shutdown.
No, no!
May be, you should have a closer look on the following topics in the manuals:
- DosShutdown
- WinCancelShutdown
- WinShutdownSystem
There are different "levels" of shutdown in OS/2. You should refer to the
Control Program Programming Guide and Reference.
VJ> I would, however, still prefer a solution for a VIO program and if you
VJ> managed to handle this please point out which way to go.
I will merge the code _NOW_ and I hope again it'll help:
/* Start of sample */
#define INCL_DOS
#define INCL_DOSPROCESS
#include
#include
VOID APIENTRY Termination ( ULONG ulTermCode );
INT main ( VOID )
{
ULONG i = 0;
DosExitList ( EXLST_ADD, (PFNEXITLIST) Termination );
/* Installs exitlist function */
printf ( "\nInnocent Victim, Ver 1.0" );
printf ( "\nWaiting to be killed or have to kill myself!" );
while ( i++ < 60 ){
DosSleep ( 1000L );
printf ( "." );
flushall ();
}
DosExit ( EXIT_PROCESS, 0 );
return (0); /* Supress warning */
}
VOID APIENTRY Termination ( ULONG ulTermCode )
{
switch ( ulTermCode ) {
case TC_EXIT: /* Normal termination */
printf ( "\nTermination Code: TC_EXIT\n" );
break;
case TC_KILLPROCESS: /* Killed by tasklist or killed by shutdown */
printf ( "\nTermination Code: TC_KILLPROCESS\n" );
break;
case TC_HARDERROR: /* RTFM */
printf ( "\nTermination Code: TC_HARDERROR\n" );
break;
case TC_TRAP: /* RTFM */
printf ( "\nTermination Code: TC_TRAP\n" );
break;
default: /* Never seen */
printf ( "\nUnknown Termination Code: %d\n", ulTermCode );
break;
}
printf ( "\nNow waiting 15 sec in exitlist-function before
terminating...\n" );
DosSleep ( 15000L ); /* Exitlist processing _should_ be shorter, of course! */
DosExitList ( EXLST_EXIT, 0 ); /* continue with next function in list */
}
/* End of sample */
The _same_ galaxy, I'd used to live in! (...most of my time...)
Bye/2
Stephan
"Microsoft, MS, MS-DOS, Windows und Bug sind eingetragene
Warenzeichen der Microsoft Corporation"
(c) 1992-1996 by Peter Mandrella
--- CrossPoint v3.11 R
VJ> * Origin: Milky Way, Earth, Germany, Niedersachen, Isernhagen* Origin: Are you sure? (y/n) y ...SCH**SSE!! (2:2426/5060.58) SEEN-BY: 50/99 54/99 270/101 620/243 625/110 160 711/430 808 934 712/311 407 SEEN-BY: 712/505 506 517 623 624 704 713/317 800/1 @PATH: 2426/5000 2001 2432/200 2433/1200 225 270/101 712/624 711/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™.