mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-10 01:55:59 +00:00
Asserts on free and alloc
This commit is contained in:
parent
f813e7b6ea
commit
7c8cf2e1e2
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"*.tpp": "cpp"
|
||||
}
|
||||
}
|
@ -49,7 +49,7 @@ namespace sta
|
||||
*
|
||||
* @param block names the block to free.
|
||||
*/
|
||||
osStatus_t free(void *block);
|
||||
void free(void *block);
|
||||
|
||||
private:
|
||||
osMemoryPoolId_t handle_; /**< CMSIS RTOS2 queue handle */
|
||||
|
@ -26,13 +26,16 @@ namespace sta
|
||||
template <typename T>
|
||||
void * RtosMemPool<T>::alloc(uint32_t timeout /* = osWaitForever */)
|
||||
{
|
||||
return osMemoryPoolAlloc(handle_, timeout);
|
||||
void * addr = osMemoryPoolAlloc(handle_, timeout)
|
||||
STA_ASSERT_MSG(addr != nullptr, "Failed to Alloc RtosMemPool Block");
|
||||
return addr;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
osStatus_t RtosMemPool<T>::free(void * block)
|
||||
void RtosMemPool<T>::free(void * block)
|
||||
{
|
||||
return osMemoryPoolFree(handle_, block);
|
||||
STA_ASSERT_MSG(osMemoryPoolFree(handle_, block) == osOK,
|
||||
"Failed to Free RtosMemPool Block");
|
||||
}
|
||||
} // namespace sta
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user