Class: Risc::ProcessWithPid

Inherits:
Object
  • Object
show all
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

Risc::Process::NULL_PROCESSID

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Process

#init, #process_event, #process_timeout, #stop

Constructor Details

#initializeProcessWithPid

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

#pidObject (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