Question:
What will happen when the number of ticks for VDK_Sleep() is set to 0, even if the minimum number of ticks allowed is 1?
Answer:
If an API is called from an inappropriate level, a KernelPanic is typically raised. For this VDK_Sleep(), the possible error code is "kInvalidDelay". We can see this details from the VDK status window( You can navigate via "View -> VDK Windows -> Status).
VDK calls an internal function named KernelPanic() under certain circumstances to indicate an error from which the system cannot recover. By default, the function loops indefinitely so that users can determine that a problem has occurred and provide information to facilitate debugging.
The KernelPanic() function disables interrupts on entry to ensure that execution loops in the intended location. We can override KernelPanic() in order to handle these types of errors differently; for example, you can reset the hardware when a KernelPanic occurs.
The circumstances under which KernelPanic() is called include the following.
• Errors in the creation of a VDK boot item during startup
• Runtime errors that are not handled by a C/C++ Thread’s error handler
• VDK internal errors
Refer "VDK Error Codes and Error Values" chapter in the 'VDK (Kernel) User’s Guide' from the below help page for more information on the possible errors for VDK API's:
Help > Contents > Manuals > Software Tools Manuals > VDK Manual > VDK (Kernel) User’s Guide > 5 VDK API Reference > VDK Error Codes and Error Values