You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Once OSAL is initialized, normally it runs forever until rebooted, or the process exits in the case of Linux. In that light, resources obtained during OS_API_Init() cannot directly/simply be released via the API - there is no opposite/inverse routine defined.
However under testing conditions, and for general completeness of API, it is useful to have an inverse function to tear down the API structures and return the system to the state it was prior to the OS_API_Init() call.
This can (almost) be done with the current OSAL API, but it must be done in two parts:
OS_DeleteAllObjects() will clean up any remaining user-instantiated objects in the tables.
OS_ApplicationShutdown(true) will cause any internal resources, such as the console utility task, to also self-exit.
The combination of these two basically leaves the system in a state similar to what it was before OS_API_Init() was run. (its not perfect, but its close).
But its not ideal because a user shouldn't have to call two functions (one of which also has a parameter) to undo the init call.
Describe the solution you'd like
Implement a void OS_API_Teardown(void) routine which would be just be a wrapper around these two currently-existing functions, to make it simpler to do this.
Importantly, being a void/void routine means that it can be easily used with unit tests and the UtTest_AddTeardown() routine.
Describe alternatives you've considered
Leave as-is
Additional context
Issue #197 which calls for something like this that unit tests can use.
Requester Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Once OSAL is initialized, normally it runs forever until rebooted, or the process exits in the case of Linux. In that light, resources obtained during OS_API_Init() cannot directly/simply be released via the API - there is no opposite/inverse routine defined.
However under testing conditions, and for general completeness of API, it is useful to have an inverse function to tear down the API structures and return the system to the state it was prior to the
OS_API_Init()
call.This can (almost) be done with the current OSAL API, but it must be done in two parts:
OS_DeleteAllObjects()
will clean up any remaining user-instantiated objects in the tables.OS_ApplicationShutdown(true)
will cause any internal resources, such as the console utility task, to also self-exit.The combination of these two basically leaves the system in a state similar to what it was before
OS_API_Init()
was run. (its not perfect, but its close).But its not ideal because a user shouldn't have to call two functions (one of which also has a parameter) to undo the init call.
Describe the solution you'd like
Implement a
void OS_API_Teardown(void)
routine which would be just be a wrapper around these two currently-existing functions, to make it simpler to do this.Importantly, being a void/void routine means that it can be easily used with unit tests and the
UtTest_AddTeardown()
routine.Describe alternatives you've considered
Leave as-is
Additional context
Issue #197 which calls for something like this that unit tests can use.
Requester Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: