Module: PSched

Extended by:
FFI::Library
Defined in:
lib/psched.rb

Overview

TODO:

Are there better ways?

A module and a class (Operation) for implementing a recurring call as deterministic as possible.

See Operation for usage details. Module functions are FFI wrappers and are not intended to be used directly.

Author:

  • Paolo Bosetti

Defined Under Namespace

Classes: Operation

Instance Method Summary collapse

Instance Method Details

#alarm(seconds) ⇒ Fixnum

Set a timer to deliver the signal SIGALRM to the calling process after the specified number of seconds

Parameters:

  • seconds (Fixnum)

    delay in microseconds

Returns:

  • (Fixnum)

    the amount of time left on the clock from a previous call to alarm()



39
# File 'lib/psched.rb', line 39

attach_function :alarm, [:uint], :uint

#setpriority(which, who, prio) ⇒ 0|-1

Set the scheduling priority of the current process

Parameters:

  • which (Fixnum)

    The type of priority, as for the enum which

  • who (Fixnum)

    The process, group, user or thread

  • prio (Fixnum)

    The priority level, from -20 to 20

Returns:

  • (0|-1)

    0 if no error, -1 if error



55
# File 'lib/psched.rb', line 55

attach_function :setpriority, [:which, :uint, :int], :int

#ualarm(useconds, interval) ⇒ Fixnum

The ualarm() function waits a count of useconds before asserting the terminating signal SIGALRM. System activity or time used in processing the call may cause a slight delay. If the interval argument is non-zero, the SIGALRM signal will be sent to the process every interval microseconds after the timer expires (e.g.,after useconds number of microseconds have passed).

Parameters:

  • useconds (Fixnum)

    initial delay in microseconds

  • interval (Fixnum)

    recurring interval in microseconds

Returns:

  • (Fixnum)

    the amount of time left on the clock



31
# File 'lib/psched.rb', line 31

attach_function :ualarm, [:uint, :uint], :uint