Service Function 0002h Suspend Switcher

les di, NewService ;new address of service-function handler

mov ax, 0002h ;Suspend Switcher

call [Service] ;service-function handler

jc error_handler

mov [Result], ax ;0 = suspended, 1 = not suspended, don't start

;2 = not suspended, okay to start

Suspend Switcher (Service Function 0002h) notifies the current task switcher that it should suspend operations because another task switcher is being initialized.

Only a task switcher that needs to suspend the current task switcher should call this function. Client programs, especially programs in global memory, must not call it.

Parameter

NewService

Points to the new task switcher's service-function handler. The current task switcher can use this address to call the new task switcher's service functions, such as Get Version (Service Function 0000h).

Return Value

If Suspend Switcher is successful, the carry flag is clear and the AX register contains a value specifying whether the task switcher has suspended operations. This value can be one of the following:

Value Meaning

0000h Current task switcher has suspended operations.
0001h Current task switcher has not suspended operations. The new task switcher must not start.
0002h Current task switcher has not suspended operations, but the new task switcher can start and run in conjunction with it.

All other values are reserved.

If the current task switcher does not support this function, the carry flag is set.

Comments

As long as they conform to the task-switching protocol, two or more active task switchers can safely coexist. Suspend Switcher helps the user avoid the confusion sometimes caused by the presence of multiple task switchers.

If the current task switcher returns 0001h, the new task switcher should not disable its session-switching capabilities unless another task switcher denies the new task switcher's call to Init Switcher (Notification Function 0000h).

After a task switcher has received a Suspend Switcher call, it should continue to respond to service functions, but it should neither respond to keyboard interrupts nor attempt to switch sessions until it receives a corresponding call to Resume Switcher (Service Function 0003h).

Suspend Switcher calls can be nested, so suspended task switchers should not become active until they have received an equal number of calls to Suspend Switcher and Resume Switcher. An exception to this rule occurs when a child program running a separate task switcher suspends its session manager's task switcher and does not reactivate it before returning control to the session manager. In this case, the session manager can safely reactivate its own task switcher.

A task switcher processing Suspend Switcher can enable interrupts and call any MS-DOS system function. Although the task switcher modifies the AX register, it must preserve all other registers.

Client programs that need to suspend session switching should return 0001h to Query Suspend (Notification Function 0001h).

A task switcher normally calls Suspend Switcher by using the service-function-handler address received from Detect Switcher (Interrupt 2Fh Function 4B02h), rather than in response to a notification function.

See Also

Interrupt 2Fh Function 4B02h Detect Switcher
Service Function 0000h Get Version
Service Function 0003h Resume Switcher
Notification Function 0000h Init Switcher
Notification Function 0001h Query Suspend