| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Killing a parent |
Hi All,
I've writen a PM program which starts another PM program.
In both programs I register the exit routines, and normally both programs
exit via my routine.
My problem comes when the parent program has started another session. If at
that moment the parent process is killed (via the tasklist, or due to an
error) the child is ended, but the parent process is never going through
the exit routine. Instead it keeps the CPU 100 % busy, and cannot be killed
by programs like 'Killem'. OS/2 also thinks the program is still running.
Am I doing anything wrong ?
(Part of source below)
/* Exit Initialisation */
if( DosExitList( EXLST_ADD, (PFNEXITLIST)ExitPgm ) )
return 1;
/* My Exit Routine */
void APIENTRY ExitPgm(USHORT usTermCode)
{
WinDestroyWindow (hwndMain);
if(hmq) WinDestroyMsgQueue (hmq);
if(hab) WinTerminate (hab);
ErrorFlag=DosOpenEventSem(SEM_SESSION,&SemHandle);
if(!ErrorFlag)
{
ErrorFlag=DosPostEventSem(SemHandle);
ErrorFlag=DosCloseEventSem(SemHandle);
}
DosExitList(EXLST_EXIT,0L);
} // ExitPgm
/* My StartSession routine */
void StartSession ( char *Pgm, char *CmdLine, char *Title )
{
ULONG teller;
STARTDATA StartData;
ULONG PidSession;
PID ProcessId;
int Ret;
WinEnableWindow (hwndMain, FALSE);
DosResetEventSem(SemHandle, &teller);
memset( &StartData, 0, sizeof( STARTDATA ) );
StartData.Length = sizeof( STARTDATA );
StartData.Related = FALSE;
StartData.FgBg = FALSE;
StartData.TraceOpt = 0;
StartData.PgmTitle = Title;
StartData.PgmName = Pgm;
StartData.PgmInputs = CmdLine;
StartData.TermQ = 0;
StartData.Environment = NULL;
StartData.InheritOpt = 1;
StartData.SessionType = 3;
StartData.IconFile = 0;
StartData.PgmHandle = 0L;
StartData.PgmControl = 0;
Ret = DosStartSession( &StartData, &PidSession, &ProcessId );
if ( Ret )
{
DosPostEventSem( SemHandle);
WinEnableWindow (hwndMain, TRUE);
}
}
Oh, BTW: I'm using BCOS/2 1.5
Tnx, Johan.
--- The-Box Point 0.15+ PC
* Origin: johan{at}bitbike.com - CIS: 100120,2502 (2:283/512.16)SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1 @PATH: 283/512 280/801 270/101 712/515 711/808 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™.