Class: Risc::ProcessWithPid
- Inherits:
-
Object
- Object
- Risc::ProcessWithPid
- Includes:
- Process
- Defined in:
- lib/risc/ProcessWithPid.rb
Overview
Utility Process class providing a utility interface with the simulator. This is a sligtly more advanced Process class that provides automatic management of the process identifier.
Constant Summary
Constants included from Process
Instance Attribute Summary collapse
-
#pid ⇒ Object
readonly
Process id of this process.
Instance Method Summary collapse
-
#activate(mode = 0) ⇒ Object
Activates this process within the simulator.
-
#initialize ⇒ ProcessWithPid
constructor
A new instance of ProcessWithPid.
Methods included from Process
#init, #process_event, #process_timeout, #stop
Constructor Details
#initialize ⇒ ProcessWithPid
Returns a new instance of ProcessWithPid.
37 38 39 |
# File 'lib/risc/ProcessWithPid.rb', line 37 def initialize @pid = NULL_PROCESSID end |
Instance Attribute Details
#pid ⇒ Object (readonly)
Process id of this process.
35 36 37 |
# File 'lib/risc/ProcessWithPid.rb', line 35 def pid @pid end |
Instance Method Details
#activate(mode = 0) ⇒ Object
Activates this process within the simulator. Creates a simulator process with this process object. The same ProcessWithPId can be activated only once. Returns the ProcessId of the created simulator process or NULL_PROCESSID if this process object is already associated with a simulation process. See Sim#create_process and Sim#create_process.
48 49 50 51 52 53 54 |
# File 'lib/risc/ProcessWithPid.rb', line 48 def activate(mode = 0) if (@pid == NULL_PROCESSID) then return @pid = Sim::create_process(self,mode) else return NULL_PROCESSID end end |