29 #include "MemoryPool.h" 30 #include "cmsis_os2.h" 31 #include "mbed_rtos_storage.h" 32 #include "mbed_rtos1_types.h" 34 #include "platform/mbed_toolchain.h" 35 #include "platform/NonCopyable.h" 37 #ifndef MBED_NO_GLOBAL_USING_DIRECTIVE 59 template<
typename T, u
int32_t queue_sz>
78 return _queue.empty();
105 return _pool.
alloc();
192 return _queue.put(mptr);
207 osEvent
get(uint32_t millisec = osWaitForever)
209 osEvent evt = _queue.get(millisec);
210 if (evt.status == osEventMessage) {
211 evt.status = osEventMail;
226 return _pool.
free(mptr);
osStatus put(T *mptr)
Put a mail in the queue.
T * calloc_until(uint64_t millisec)
Allocate a memory block from a memory pool, blocking, and set memory block to zero.
bool empty() const
Check if the mail queue is empty.
The Queue class represents a collection of objects that are stored first by order of priority...
T * alloc_until(uint64_t millisec)
Allocate a memory block from a memory pool, blocking.
T * calloc_for(uint32_t millisec)
Allocate a memory block of type T, optionally blocking, and set memory block to zero.
T * alloc_for(uint32_t millisec)
Allocate a memory block from a memory pool, optionally blocking.
T * calloc_until(uint64_t millisec)
Allocate a memory block of type T, blocking, and set memory block to zero.
T * alloc(MBED_UNUSED uint32_t millisec=0)
Allocate a memory block of type T, without blocking.
Prevents generation of copy constructor and copy assignment operator in derived classes.
Mail()
Create and initialize Mail queue.
T * alloc_until(uint64_t millisec)
Allocate a memory block of type T, blocking.
The Mail class allows you to control, send, receive or wait for mail.
osStatus free(T *block)
Free a memory block.
T * calloc(void)
Allocate a memory block from a memory pool, without blocking, and set memory block to zero...
osStatus free(T *mptr)
Free a memory block from a mail.
T * calloc(MBED_UNUSED uint32_t millisec=0)
Allocate a memory block of type T, and set memory block to zero.
T * alloc_for(uint32_t millisec)
Allocate a memory block of type T, optionally blocking.
bool full() const
Check if the mail queue is full.
T * calloc_for(uint32_t millisec)
Allocate a memory block from a memory pool, optionally blocking, and set memory block to zero...
T * alloc(void)
Allocate a memory block from a memory pool, without blocking.