[ Home | Alpha index | Topic index | Tutorials | Download | Feedback ]

The OS/2 API Project

DosStopSession

[ Syntax | Params | Returns | Include | Usage | Structs | Gotchas | Code | Also ]

Syntax

rc = DosStopSession( ulScope, ulIDSession );

Parameters

ULONG ulScope (input)
Specifies whether a given child session or all child sessions should be ended. Values are:
Value  Name                    Description
0      STOP_SESSION_SPECIFIED  End the child session 
                               specified in ulIDSession
1      STOP_SESSION_ALL        End all child sessions. 
                               ulIDSession is ignored
ULONG ulIDSession (input)
Specifies which child session to stop. ulScope must be STOP_SESSION_SPECIFIED (=0).

Returns

APIRET  rc
0       NO_ERROR
369     ERROR_SMG_INVALID_SESSION_ID
418     ERROR_SMG_INVALID_CALL
458     ERROR_SMG_INVALID_STOP_OPTION
459     ERROR_SMG_BAD_RESERVE
460     ERROR_SMG_PROCESS_NOT_PARENT
463     ERROR_SMG_RETRY_SUB_ALLOC

Include Info

#define INCL_DOSSESMGR
#include <os2.h>

Usage Explanation

DosStopSession ends one or all child sessions. Only a child session started with DosStartSession, with Related set to SSF_RELATED_CHILD (=1), can be ended with DosStopSession. If the child session has related child sessions these are also ended. If the child process is executed in the foreground when it is ended the parent session becomes the foreground session. Since a process in the specified session may refuse to end, the only way to guarantee that the target session has ended is to wait for notification through the termination queue specified with DosStartSession.

Relevant Structures

Gotchas

Sample Code

#define DOS_SESMGR #include <os2.h> ULONG ulIDSession; STATUSDATA sd; /* Start child session with DosStartSession */ /* psd->Related = SSF_RELATED_CHILD; */ /* DosStartSession(psd,&ulIDSession,..); */ if(DosStopSession(STOP_SESSION_SPECIFIED, ulIDSession)) /* Establish the bond */ { /* Problems */ } else { /* The child session will end, unless it refuses, */ /* check the termination queue from DosStartSession to be sure */ }

See Also

DosStartSession

Author

Oscar Gustafsson - oscar@lysator.liu.se

Additions

Last modified September 21/1996
Please send all errors, comments, and suggestions to: timur@vnet.ibm.com

The OS/2 API Project

DosStopSession