Root > Reference > All Functions > EnsureThreadStack

Function EnsureThreadStack

Previous pageReturn to chapter overviewNext page   

Sets the minimum size of the stack associated with the calling thread or fiber that will be available during any stack overflow exceptions. This is useful for handling stack overflow exceptions; the application can safely use the specified number of bytes during exception handling.

 

Unit

ELowLevel

 

Syntax

 

Code (Delphi)

function EnsureThreadStack: Boolean;

 

Return value

If the function succeeds, the return value is True. If the function fails, the return value is False. To get extended error information, call GetLastError.

 

Remarks

You can specify the reserved stack space by setting the _ThreadStackGuarantee global variable. The function will do nothing if _ThreadStackGuarantee is zero or less than the current size.

 

If the function is successful, the application can handle possible EStackOverflow exceptions using structured exception handling. To resume execution after handling a stack overflow, you must perform certain recovery steps. Call the _resetstkoflwtstkoflw function.

 

To set the stack guarantee for a fiber, you must first call the SwitchToFiber function to execute the fiber. After you set the guarantee for this fiber, it is used by the fiber no matter which thread executes the fiber.

 

See also

_ThreadStackGuarantee
_resetstkoflw



Send feedback... Build date: 2024-12-19
Last edited: 2024-12-19
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.


Permanent link to this article: https://www.eurekalog.com/help/eurekalog/topic_function_elowlevel_ensurethreadstack.php