A set of wrappers and services easing the transition from Xenomai 2.x to 3.x.
More...
A set of wrappers and services easing the transition from Xenomai 2.x to 3.x.
This interface provides a source compatibility layer for building applications based on the Xenomai 2.x posix and native APIs over Xenomai 3.x.
◆ pthread_make_periodic_np()
| int pthread_make_periodic_np |
( |
pthread_t |
thread, |
|
|
struct timespec * |
starttp, |
|
|
struct timespec * |
periodtp |
|
) |
| |
Make a thread periodic (compatibility service).
This service makes the POSIX thread periodic.
- Parameters
-
| thread | thread to arm a periodic timer for. |
| starttp | start time, expressed as an absolute value of the CLOCK_REALTIME clock. |
| periodtp | period, expressed as a time interval. |
- Returns
- 0 on success;
-
an error number if:
- ESRCH, thread is invalid.
- ETIMEDOUT, the start time has already passed.
- EPERM, the caller is not a Xenomai thread.
- EINVAL, thread does not refer to the current thread.
- Note
- Unlike the original Xenomai 2.x call, this emulation does not delay the caller waiting for the first periodic release point. In addition, thread must be equal to pthread_self().
- Deprecated:
- This service is a non-portable extension of the Xenomai 2.x POSIX interface, not available with Xenomai 3.x. Instead, Cobalt-based applications should set up a periodic timer using the timer_create(), timer_settime() call pair, then wait for release points via sigwaitinfo(). Overruns can be detected by looking at the siginfo.si_overrun field. Alternatively, applications may obtain a file descriptor referring to a Cobalt timer via the timerfd() call, and read() from it to wait for timeouts.
References timer_create().
◆ pthread_wait_np()
| int pthread_wait_np |
( |
unsigned long * |
overruns_r | ) |
|
Wait for the next periodic release point (compatibility service)
Delay the current thread until the next periodic release point is reached. The periodic timer should have been previously started for thread by a call to pthread_make_periodic_np().
- Parameters
-
| overruns_r | If non-NULL, overruns_r shall be a pointer to a memory location which will be written with the count of pending overruns. This value is written to only when pthread_wait_np() returns ETIMEDOUT or success. The memory location remains unmodified otherwise. If NULL, this count will not be returned. |
- Returns
- Zero is returned upon success. If overruns_r is non-NULL, zero is written to the pointed memory location. Otherwise:
- EWOULDBLOCK is returned if pthread_make_periodic_np() was not called for the current thread.
- EINTR is returned if thread was interrupted by a signal before the next periodic release point was reached.
- ETIMEDOUT is returned if a timer overrun occurred, which indicates that a previous release point was missed by the calling thread. If overruns_r is non-NULL, the count of pending overruns is written to the pointed memory location.
- EPERM is returned if this service was called from an invalid context.
- Note
- If the current release point has already been reached at the time of the call, the current thread immediately returns from this service with no delay.
- Deprecated:
- This service is a non-portable extension of the Xenomai 2.x POSIX interface, not available with Xenomai 3.x. Instead, Cobalt-based applications should set up a periodic timer using the timer_create(), timer_settime() call pair, then wait for release points via sigwaitinfo(). Overruns can be detected by looking at the siginfo.si_overrun field. Alternatively, applications may obtain a file descriptor referring to a Cobalt timer via the timerfd() call, and read() from it to wait for timeouts.