µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os::rtos::result Namespace Reference

Values returned by RTOS functions. More...

Enumerations

enum  : result_t { ok = 0 }
 Custom enumerated values. More...
 

Detailed Description

Values returned by RTOS functions.

This namespace is dedicated to grouping all status code values returned by µOS++ RTOS functions.

However, µOS++ favours POSIX error codes, so, except a few enumerated values, most of them are exactly those defined by POSIX, in the <errno.h> header, and are not redefined here.

Currently in use are:

  • EPERM - Operation not permitted. An attempt was made to perform an operation limited to processes with appropriate privileges or to the owner of a file or other resource. In µOS++ this usually means that the call is not available in handler mode.
  • EINVAL - Invalid argument. Some invalid argument was supplied;
  • EWOULDBLOCK - Operation would block. In µOS++ case, this usually means that a call to try_xxx() found the resource busy.
  • EAGAIN - Resource temporarily unavailable. This is a temporary condition and later calls to the same routine may complete normally.
  • ENOTRECOVERABLE - State not recoverable. In µOS++ this usually means an unrecoverable error occurred.
  • EDEADLOCK - Resource deadlock would occur. An attempt was made to lock a system resource that would have resulted in a deadlock situation.
  • EMSGSIZE - Message too large. A message sent on a transport provider was larger than an internal message buffer or some other network limit, or inappropriate message buffer length.
  • EBADMSG - Bad message. The implementation has detected a corrupted message.
  • EINTR - Interrupted function call. In µOS++ this usually mens that a thread waiting for a message is waken before the event or the timeout occurred, at user request.
  • ETIMEDOUT - Operation timed out. The time limit associated with the operation was exceeded before the operation completed.
  • EOWNERDEAD - Previous owner died. The owner of a robust mutex terminated while holding the mutex lock.
Example
void
func (void)
{
mutex mx;
...
result_t res = mx.try_lock();
if (res == result::ok)
{
// All is well, mutex locked.
}
else if (res == EWOULDBLOCK)
{
// Mutex busy, try again later.
}
}
POSIX compliant mutex.
Definition os-mutex.h:53
result_t try_lock(void)
Try to lock/acquire the mutex.
@ ok
Function completed; no errors or events occurred.
Definition os-decls.h:181
uint32_t result_t
Type of values returned by RTOS functions.
Definition os-decls.h:96

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : result_t

Custom enumerated values.

There are not many custom values returned by µOS++ RTOS functions, currently there is only one, ok, represented by 0.

If more custom codes will be needed and are not present in POSIX, this is the place where to add them. Just be sure their numeric values do not overlap POSIX values (check for a definition with the last allocated POSIX error number).

Enumerator
ok 

Function completed; no errors or events occurred.

Definition at line 175 of file os-decls.h.