Skip to content

Add units to timeout argument in EventFlags #9670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions rtos/EventFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,28 @@ 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()
{
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);
}

}
14 changes: 7 additions & 7 deletions rtos/EventFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,23 @@ class EventFlags : private mbed::NonCopyable<EventFlags> {

/** 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.

Expand All @@ -113,7 +113,7 @@ class EventFlags : private mbed::NonCopyable<EventFlags> {

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;
};
Expand Down
2 changes: 1 addition & 1 deletion rtos/Mail.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {

/** 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.
Expand Down
4 changes: 2 additions & 2 deletions rtos/Mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Mutex : private mbed::NonCopyable<Mutex> {

@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.
Expand All @@ -117,7 +117,7 @@ class Mutex : private mbed::NonCopyable<Mutex> {
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
Expand Down
2 changes: 1 addition & 1 deletion rtos/Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
* 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
Expand Down
2 changes: 1 addition & 1 deletion rtos/Semaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Semaphore : private mbed::NonCopyable<Semaphore> {
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.
Expand Down
4 changes: 2 additions & 2 deletions rtos/ThisThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion rtos/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ class Thread : private mbed::NonCopyable<Thread> {

/** 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.
Expand Down