Notification Function 0005h Create Session

mov bx, SessionID ;identifier for new session

les di, Service ;es:di is address of service-function handler

mov ax, 0005h ;Create Session

call [Notification] ;client program's notification-function handler

cmp ax, 1

je no_create ;1 = don't create session

Create Session (Notification Function 0005h) notifies client programs that the task switcher is about to create a new session.

Parameters

sessionID

Identifies the session to be created. This parameter consists of a 4-bit switcher identifier (in the most significant 4 bits) and a 12-bit session number (in the low-order 12 bits).

Service

Points to the service-function handler for the task switcher.

Return Value

The AX register contains 0000h if a new session can be created safely or 0001h if the client program cannot safely handle a new session.

All other values are reserved.

Comments

Before creating a new session, the task switcher calls Create Session to allow client programs to prevent the session from being created. If, for example, global client programs keep information for each session in a fixed-length data structure, they may respond to the notification by preventing the new session if the structure does not have enough room for it.

A newly created session does not have to be activated immediately; other sessions can be created, destroyed, and switched before the new session is activated.

If any client program returns 0001h to Create Session, all client programs may receive a call to Destroy Session (Notification Function 0006h), including the program that returned 0001h. Client programs can ignore a call to Destroy Session received without a preceding call to Create Session.

The task switcher enables interrupts before calling the client program. The client program can call any MS-DOS system function. Although the client program modifies the AX register, it must preserve all other registers.

See Also

Notification Function 0006h Destroy Session