![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Deadlock Detection The Apex runtime is able to detect most forms of deadlock between tasks. When Deadlock is detected, the runtime prints the message "Deadlock Detected" and exits. This is normally done after the main subprogram returns and when the following two conditions are satisfied:
- No task is ready to run.
- No task is suspended at an Ada delay statement, at a call to XCalendar.Delay_Until, at a timed entry call, or at a select statement with an open delay alternative.
However, to accommodate interrupt entries, protected procedure handlers, and attached ISRs, either of the following conditions inhibits a program from exiting:
- A task is suspended at an accept or select with an open interrupt entry. Interrupt entries at a select with terminate are considered closed.
- A task is suspended on an entry of a protected object with a ceiling in the range of System.Interrupt_Priority. Note that this is true whether or not the object contains any handlers, since a handler in another object can initiate a protected action that can open the barrier on this entry.
- The Ada RTS Exit_Disable_Flag is True. This flag is initialized to False. It is normally set to True by the application program if it attaches an ISR. This flag can be read or set by the VADS Exec services in V_Xtasking, Current_Exit_Disabled, and Set_Exit_Disabled. Alternatively, this flag may be referenced using V_I_Tasks in rational.ss (Get_Exit_Disabled_Flag and Set_Exit_Disabled_Flag).
Note: To allow a program with open interrupt entries to exit upon the completion of the main program, code the simple accept statement as a select or terminate statement, as illustrated:
loop select accept Ctrl_C do -- Ctrl_C Logic, such as -- following call to terminate -- the program V_I_Tasks.Terminate_Program(0); end; or terminate; end select; end loop;
Rational Software Corporation http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2002, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |