NAME | SYNOPSIS | FEATURES | DESCRIPTION | RETURN VALUES | ERRORS | ATTRIBUTES | SEE ALSO
#include <vtimer/chVtimer.h>int svVirtualTimeoutSet(KnCap * actor, KnThreadLid threadli, KnVirtTimeout * vtimeout, KnVirtToHdl handler, KnTimeVal * cputime, int flag);
VTIMER
The svVirtualTimeoutSet system call sets a timeout on the execution time of the thread whose local identifier is threadLi within the actor specified by actorcap.
If threadli is set to K_ALLACTORTHREADS, the timeout applies to the total execution time of all threads in the actor designated by actorcap . Once the designated thread or threads have consumed cputime of additional execution time, the handler designated by handler is entered with vtimeout as its sole argument. (Virtual timeouts are always relative.)
If flag is set to K_VTIME_INTERNAL, only execution time in the threads' home actor is counted toward the timeout.
If flag is set to K_VTIME_TOTAL, all execution time is counted, regardless of whether or not the thread is executing in a cross-actor invocation.
In the K_ALLACTORTHREADS case, thread execution time is charged to the thread's owning actor only, not to the execution actor.
The KnVirtTimeout object is opaque; it must be pre-allocated by the caller, but its fields are inaccessible to the caller.
Virtual timeout handlers are not invoked at interrupt level. The execution environment is similar to that of an abort handler. The handler is executed by the affected thread (or the next affected thread to run, if an actor-level timeout), and has no restrictions on use of system calls. A thread can be diverted to execute a handler only when executing in its owning actor; during any cross-actor invocation (trap, ipc, or lap call), handler execution is masked.
The svVirtualTimeoutCancel system call attempts to cancel a virtual timeout request. The vtimeout argument contains the address of the KnVirtTimeout object used in the corresponding call to svVirtTimeoutSet. If the timeout request is still pending, it is cancelled and the call returns K_EOK. If the virtual timeout interval expired and the handler invocation has been posted, the call takes no action and returns K_ETIMEOUT. In the latter case, no information is available as to whether the handler execution has actually begun, nor whether the handler is still executing.
A timeout cannot be reinstalled. To reinstall a timeout request, the timeout must be previously cancelled, otherwise an unpredictable behaviour may occur.
Upon successful completion, svVirtualTimeoutSet and svTimeoutCancel return K_OK. Otherwise, a negative error code is returned.
threadli does not designate a valid thread, or the time value referenced by cputime is invalid, or flag contains an invalid value, or actor capability is not valid.
The system is ou t of resources.
actor is unreachable.
( svVirtualTimeoutCancel only) the virtual interval had already expired, and the handler had been queued for execution.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | FEATURES | DESCRIPTION | RETURN VALUES | ERRORS | ATTRIBUTES | SEE ALSO