mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Change EventFlag timeout paramter
Matches rest of RTOS class timeout parameters by using the unit name. Remove ambigious statement in reference to 0 ms being no-timeout as a timeout of 0 causes the function to not block and return immediately (osWaitForever is used as no timeout as it will wait forever)pull/9670/head
							parent
							
								
									f04d51b2cd
								
							
						
					
					
						commit
						f1abca35cf
					
				| 
						 | 
				
			
			@ -62,14 +62,14 @@ uint32_t EventFlags::get() const
 | 
			
		|||
    return osEventFlagsGet(_id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t EventFlags::wait_all(uint32_t flags, uint32_t timeout, bool clear)
 | 
			
		||||
uint32_t EventFlags::wait_all(uint32_t flags, uint32_t millisec, bool clear)
 | 
			
		||||
{
 | 
			
		||||
    return wait(flags, osFlagsWaitAll, timeout, clear);
 | 
			
		||||
    return wait(flags, osFlagsWaitAll, millisec, clear);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t EventFlags::wait_any(uint32_t flags, uint32_t timeout, bool clear)
 | 
			
		||||
uint32_t EventFlags::wait_any(uint32_t flags, uint32_t millisec, bool clear)
 | 
			
		||||
{
 | 
			
		||||
    return wait(flags, osFlagsWaitAny, timeout, clear);
 | 
			
		||||
    return wait(flags, osFlagsWaitAny, millisec, clear);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
EventFlags::~EventFlags()
 | 
			
		||||
| 
						 | 
				
			
			@ -77,13 +77,13 @@ EventFlags::~EventFlags()
 | 
			
		|||
    osEventFlagsDelete(_id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t EventFlags::wait(uint32_t flags, uint32_t opt, uint32_t timeout, bool clear)
 | 
			
		||||
uint32_t EventFlags::wait(uint32_t flags, uint32_t opt, uint32_t millisec, bool clear)
 | 
			
		||||
{
 | 
			
		||||
    if (clear == false) {
 | 
			
		||||
        opt |= osFlagsNoClear;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return osEventFlagsWait(_id, flags, opt, timeout);
 | 
			
		||||
    return osEventFlagsWait(_id, flags, opt, millisec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -87,23 +87,23 @@ public:
 | 
			
		|||
 | 
			
		||||
    /** Wait for all of the specified event flags to become signaled.
 | 
			
		||||
      @param   flags    the flags to wait for (default: 0 -- no flags).
 | 
			
		||||
      @param   timeout  timeout value or 0 in case of no time-out (default: osWaitForever).
 | 
			
		||||
      @param   millisec timeout value (default: osWaitForever).
 | 
			
		||||
      @param   clear    clear specified event flags after waiting for them (default: true).
 | 
			
		||||
      @return  event flags before clearing or error code if highest bit set (see @a osFlagsError for details).
 | 
			
		||||
 | 
			
		||||
      @note You may call this function from ISR context if the timeout parameter is set to 0.
 | 
			
		||||
      @note You may call this function from ISR context if the millisec parameter is set to 0.
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t wait_all(uint32_t flags = 0, uint32_t timeout = osWaitForever, bool clear = true);
 | 
			
		||||
    uint32_t wait_all(uint32_t flags = 0, uint32_t millisec = osWaitForever, bool clear = true);
 | 
			
		||||
 | 
			
		||||
    /** Wait for any of the specified event flags to become signaled.
 | 
			
		||||
      @param   flags    the flags to wait for (default: 0 -- no flags).
 | 
			
		||||
      @param   timeout  timeout value or 0 in case of no timeout (default: osWaitForever).
 | 
			
		||||
      @param   millisec timeout value (default: osWaitForever).
 | 
			
		||||
      @param   clear    clear specified event flags after waiting for them (default: true).
 | 
			
		||||
      @return  event flags before clearing or error code if highest bit set (see @a osFlagsError for details).
 | 
			
		||||
 | 
			
		||||
      @note This function may be called from ISR context if the timeout parameter is set to 0.
 | 
			
		||||
      @note This function may be called from ISR context if the millisec parameter is set to 0.
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t wait_any(uint32_t flags = 0, uint32_t timeout = osWaitForever, bool clear = true);
 | 
			
		||||
    uint32_t wait_any(uint32_t flags = 0, uint32_t millisec = osWaitForever, bool clear = true);
 | 
			
		||||
 | 
			
		||||
    /** EventFlags destructor.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -113,7 +113,7 @@ public:
 | 
			
		|||
 | 
			
		||||
private:
 | 
			
		||||
    void constructor(const char *name = NULL);
 | 
			
		||||
    uint32_t wait(uint32_t flags, uint32_t opt, uint32_t timeout, bool clear);
 | 
			
		||||
    uint32_t wait(uint32_t flags, uint32_t opt, uint32_t millisec, bool clear);
 | 
			
		||||
    osEventFlagsId_t                _id;
 | 
			
		||||
    mbed_rtos_storage_event_flags_t _obj_mem;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -131,7 +131,7 @@ public:
 | 
			
		|||
 | 
			
		||||
    /** Get a mail from the queue.
 | 
			
		||||
     *
 | 
			
		||||
     * @param millisec Timeout value or 0 in case of no timeout (default: osWaitForever).
 | 
			
		||||
     * @param millisec Timeout value (default: osWaitForever).
 | 
			
		||||
     *
 | 
			
		||||
     * @return Event that contains mail information or error code.
 | 
			
		||||
     * @retval osEventMessage   Message received.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -95,7 +95,7 @@ public:
 | 
			
		|||
 | 
			
		||||
      @deprecated Do not use this function. This function has been replaced with lock(), trylock() and trylock_for() functions.
 | 
			
		||||
 | 
			
		||||
      @param   millisec  timeout value or 0 in case of no time-out.
 | 
			
		||||
      @param   millisec  timeout value.
 | 
			
		||||
      @return  status code that indicates the execution status of the function:
 | 
			
		||||
               @a osOK the mutex has been obtained.
 | 
			
		||||
               @a osErrorTimeout the mutex could not be obtained in the given time.
 | 
			
		||||
| 
						 | 
				
			
			@ -117,7 +117,7 @@ public:
 | 
			
		|||
    bool trylock();
 | 
			
		||||
 | 
			
		||||
    /** Try to lock the mutex for a specified time
 | 
			
		||||
      @param   millisec  timeout value or 0 in case of no time-out.
 | 
			
		||||
      @param   millisec  timeout value.
 | 
			
		||||
      @return true if the mutex was acquired, false otherwise.
 | 
			
		||||
      @note the underlying RTOS may have a limit to the maximum wait time
 | 
			
		||||
            due to internal 32-bit computations, but this is guaranteed to work if the
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -167,7 +167,7 @@ public:
 | 
			
		|||
     * share the same priority level, they are retrieved in first-in, first-out
 | 
			
		||||
     * (FIFO) order.
 | 
			
		||||
     *
 | 
			
		||||
     * @param   millisec  Timeout value or 0 in case of no time-out.
 | 
			
		||||
     * @param   millisec  Timeout value.
 | 
			
		||||
     *                    (default: osWaitForever).
 | 
			
		||||
     *
 | 
			
		||||
     * @return Event information that includes the message in event. Message
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,7 +60,7 @@ public:
 | 
			
		|||
    Semaphore(int32_t count, uint16_t max_count);
 | 
			
		||||
 | 
			
		||||
    /** Wait until a Semaphore resource becomes available.
 | 
			
		||||
      @param   millisec  timeout value or 0 in case of no time-out. (default: osWaitForever).
 | 
			
		||||
      @param   millisec  timeout value. (default: osWaitForever).
 | 
			
		||||
      @return  number of available tokens, before taking one; or -1 in case of incorrect parameters
 | 
			
		||||
 | 
			
		||||
      @note You may call this function from ISR context if the millisec parameter is set to 0.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -105,7 +105,7 @@ uint32_t flags_wait_any(uint32_t flags, bool clear = true);
 | 
			
		|||
 | 
			
		||||
/** Wait for all of the specified Thread Flags to become signaled for the current thread.
 | 
			
		||||
  @param   flags     specifies the flags to wait for
 | 
			
		||||
  @param   millisec  timeout value or 0 in case of no time-out.
 | 
			
		||||
  @param   millisec  timeout value.
 | 
			
		||||
  @param   clear     whether to clear the specified flags after waiting for them. (default: true)
 | 
			
		||||
  @return  actual thread flags before clearing, which may not satisfy the wait
 | 
			
		||||
  @note You cannot call this function from ISR context.
 | 
			
		||||
| 
						 | 
				
			
			@ -129,7 +129,7 @@ uint32_t flags_wait_all_until(uint32_t flags, uint64_t millisec, bool clear = tr
 | 
			
		|||
 | 
			
		||||
/** Wait for any of the specified Thread Flags to become signaled for the current thread.
 | 
			
		||||
  @param   flags     specifies the flags to wait for
 | 
			
		||||
  @param   millisec  timeout value or 0 in case of no time-out.
 | 
			
		||||
  @param   millisec  timeout value.
 | 
			
		||||
  @param   clear     whether to clear the specified flags after waiting for them. (default: true)
 | 
			
		||||
  @return  actual thread flags before clearing, which may not satisfy the wait
 | 
			
		||||
  @note You cannot call this function from ISR context.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -414,7 +414,7 @@ public:
 | 
			
		|||
 | 
			
		||||
    /** Wait for one or more Thread Flags to become signaled for the current RUNNING thread.
 | 
			
		||||
      @param   signals   wait until all specified signal flags are set or 0 for any single signal flag.
 | 
			
		||||
      @param   millisec  timeout value or 0 in case of no time-out. (default: osWaitForever).
 | 
			
		||||
      @param   millisec  timeout value. (default: osWaitForever).
 | 
			
		||||
      @return  event flag information or error code. @note if @a millisec is set to 0 and flag is no set the event carries osOK value.
 | 
			
		||||
 | 
			
		||||
      @note You cannot call this function from ISR context.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue