#include <vtimer/chVtimer.h>int svActorVirtualTimeoutSet(KnCap * Iactor, KnVirtTimeout * vtimeout, KnTimeVal * cputime, int flag, KnLapDesc * lapdesc);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
The svActorVirtualTimeoutSet() function sets a timeout on the total execution time of all threads created within the actor specified by actorcap .
Once the threads have consumed cputime of additional execution time, the LAP handler designated by lapdesc is invoked with vtimeout as its argument (see lapInvoke(2K) ).
If flag is set to K_VTIME_INTERNAL , only the execution time in the threads' owning actor is taken into account for the timeout.
If flag is set to K_VTIME_TOTAL , all execution time is counted, regardless of whether or not the threads are executing in cross-actor invocations.
In the case of a cross-actor invocation, thread execution time is charged only to the actor that owns the thread, not to the execution actor.
The lapDesc argument is a LAP descriptor previously created by svLapCreate(2K) .
The KnVirtTimeout object is opaque. It must be pre-allocated by the caller but its fields are inaccessible to the caller. Virtual timeouts are always relative.
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 next thread of that actor to run, and has no restrictions on the use of system calls. A thread can be diverted to execute a handler only when executing in the actor that owns the thread. During any cross-actor invocation (trap, IPC, or LAP call), virtual timeout handler execution is masked.
The svActorVirtualTimeoutCancel() function attempts to cancel a virtual timeout request. The vtimeout argument contains the address of the KnVirtTimeout object used in the corresponding call to svActorVirtualTimeoutSet() . If the timeout request is still pending, it is cancelled and the call returns K_EOK . If the virtual timeout interval has passed and the handler invocation has been posted, the call takes no action and returns K_ETIMEOUT . In the latter case, there is no information available as to whether the handler execution has actually begun, or whether the handler is still executing.
A timeout cannot be reinstalled. To reinstall a timeout request, the timeout must first be cancelled, otherwise unpredictable behaviour may occur.
On successful completion, svActorVirtualTimeoutSet() and svActorVirtualTimeoutCancel() return K_OK . Otherwise, a negative error code is returned.
The actor capability is not valid.
The validity of the LAP descriptor is not checked.
actor is unreachable.
( svActorVirtualTimeoutCancel() only) T he 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|