Skip to content

Commit

Permalink
docs: ref: kernel: memoryslabs: Adding notes if APIs called from ISR
Browse files Browse the repository at this point in the history
Added a note in documentation for k_mem_slab_alloc(),
k_mem_pool_alloc() and k_heap_alloc() are safe
to call in an interrupt with the timeout K_NO_WAIT.

Fixes: #28020

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
  • Loading branch information
yerabolu authored and carlescufi committed Sep 17, 2020
1 parent 060d365 commit 04d3c3c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/kernel.h
Expand Up @@ -4607,6 +4607,8 @@ extern int k_mem_slab_init(struct k_mem_slab *slab, void *buffer,
*
* This routine allocates a memory block from a memory slab.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
*
* @param slab Address of the memory slab.
* @param mem Pointer to block address area.
* @param timeout Non-negative waiting period to wait for operation to complete.
Expand Down Expand Up @@ -4697,6 +4699,8 @@ void k_heap_init(struct k_heap *h, void *mem, size_t bytes);
* freed. If the allocation cannot be performed by the expiration of
* the timeout, NULL will be returned.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
*
* @param h Heap from which to allocate
* @param bytes Desired size of block to allocate
* @param timeout How long to wait, or K_NO_WAIT
Expand Down Expand Up @@ -4770,6 +4774,8 @@ void k_heap_free(struct k_heap *h, void *mem);
*
* This routine allocates a memory block from a memory pool.
*
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
*
* @param pool Address of the memory pool.
* @param block Pointer to block descriptor for the allocated memory.
* @param size Amount of memory to allocate (in bytes).
Expand Down

0 comments on commit 04d3c3c

Please sign in to comment.