non blocking queue

Fork of mbed-rtos by mbed official

Revision:
31:015df9e602b6
Parent:
8:88a1a9c26ae3
Child:
123:58563e6cba1e
diff -r 3761f69dbbb2 -r 015df9e602b6 rtos/Mail.h
--- a/rtos/Mail.h	Tue May 27 08:30:16 2014 +0100
+++ b/rtos/Mail.h	Tue Jun 03 11:30:14 2014 +0100
@@ -42,17 +42,17 @@
     #ifdef CMSIS_OS_RTX
         memset(_mail_q, 0, sizeof(_mail_q));
         _mail_p[0] = _mail_q;
-        
+
         memset(_mail_m, 0, sizeof(_mail_m));
         _mail_p[1] = _mail_m;
-        
+
         _mail_def.pool = _mail_p;
         _mail_def.queue_sz = queue_sz;
         _mail_def.item_sz = sizeof(T);
     #endif
         _mail_id = osMailCreate(&_mail_def, NULL);
     }
-    
+
     /** Allocate a memory block of type T
       @param   millisec  timeout value or 0 in case of no time-out. (default: 0).
       @return  pointer to memory block that can be filled with mail or NULL in case error.
@@ -60,23 +60,23 @@
     T* alloc(uint32_t millisec=0) {
         return (T*)osMailAlloc(_mail_id, millisec);
     }
-    
-    /** Allocate a memory block of type T and set memory block to zero. 
+
+    /** Allocate a memory block of type T and set memory block to zero.
       @param   millisec  timeout value or 0 in case of no time-out.  (default: 0).
       @return  pointer to memory block that can be filled with mail or NULL in case error.
     */
     T* calloc(uint32_t millisec=0) {
         return (T*)osMailCAlloc(_mail_id, millisec);
     }
-    
+
     /** Put a mail in the queue.
       @param   mptr  memory block previously allocated with Mail::alloc or Mail::calloc.
-      @return  status code that indicates the execution status of the function. 
+      @return  status code that indicates the execution status of the function.
     */
     osStatus put(T *mptr) {
         return osMailPut(_mail_id, (void*)mptr);
     }
-    
+
     /** Get a mail from a queue.
       @param   millisec  timeout value or 0 in case of no time-out. (default: osWaitForever).
       @return  event that contains mail information or error code.
@@ -84,9 +84,9 @@
     osEvent get(uint32_t millisec=osWaitForever) {
         return osMailGet(_mail_id, millisec);
     }
-    
+
     /** Free a memory block from a mail.
-      @param   mptr  pointer to the memory block that was obtained with Mail::get. 
+      @param   mptr  pointer to the memory block that was obtained with Mail::get.
       @return  status code that indicates the execution status of the function.
     */
     osStatus free(T *mptr) {