Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

process Class Reference

holds the data for a process More...

#include <process.h>

Collaboration diagram for process:

Collaboration graph
[legend]
List of all members.

Public Types

typedef void(* instructionPtr )(virtualMachine &, process &, thread &)
typedef std::vector< instructionPtrinstructionSet

Public Member Functions

 process (program &prog, uInt pid)
 initialise active process

 ~process ()
void clean ()
 terminates and cleans up the thread

programgetProgram ()
 get the program being run

processId getId ()
 get the id of the process

threadId spawnThread (address addr)
 spawn a new thread at the specified address

void killThread (threadId tid)
 kill the specified thread

uInt getNumThreads ()
 get the number of threads currently being executed

address getThreadAddress (threadId tid)
virtual bool isTerminated ()
 test if the process has terminated


Protected Member Functions

 process ()
 initalise dead process


Protected Attributes

programm_pProgram
 pointer to the program being executed

uInt m_threadCnt
 the number of active threads

processId m_id
 the id of the process


Friends

class std::vector< thread * >

Detailed Description

holds the data for a process

Definition at line 17 of file process.h.


Member Typedef Documentation

typedef void(* process::instructionPtr)(virtualMachine &, process &, thread &)
 

Definition at line 24 of file process.h.

typedef std::vector<instructionPtr> process::instructionSet
 

Definition at line 25 of file process.h.


Constructor & Destructor Documentation

process::process program prog,
uInt  pid
 

initialise active process

process::~process  ) 
 

Definition at line 17 of file process.cpp.

References clean().

process::process  )  [protected]
 

initalise dead process

Definition at line 122 of file process.cpp.


Member Function Documentation

void process::clean  ) 
 

terminates and cleans up the thread

Definition at line 23 of file process.cpp.

References m_id, m_pProgram, and m_threadCnt.

Referenced by virtualMachine::kill(), and ~process().

processId process::getId  ) 
 

get the id of the process

Definition at line 47 of file process.cpp.

References m_id, and processId.

uInt process::getNumThreads  ) 
 

get the number of threads currently being executed

Definition at line 93 of file process.cpp.

References m_threadCnt, and uInt.

program & process::getProgram  ) 
 

get the program being run

Definition at line 40 of file process.cpp.

References ASSERT, and m_pProgram.

address process::getThreadAddress threadId  tid  ) 
 

returns g_max_uInt if thread does not exist

Definition at line 99 of file process.cpp.

References address, getThreadAddress(), and thread::isTerminated().

Referenced by getThreadAddress().

bool process::isTerminated  )  [virtual]
 

test if the process has terminated

Definition at line 114 of file process.cpp.

References m_pProgram, and m_threadCnt.

Referenced by virtualMachine::canBeExecuted().

void process::killThread threadId  tid  ) 
 

kill the specified thread

Definition at line 81 of file process.cpp.

References killThread(), and m_threadCnt.

Referenced by killThread().

threadId process::spawnThread address  addr  ) 
 

spawn a new thread at the specified address

Definition at line 53 of file process.cpp.

References address, m_threadCnt, spawnThread(), threadId, and uInt.

Referenced by virtualMachine::run(), and spawnThread().


Friends And Related Function Documentation

friend class std::vector< thread * > [friend]
 

Definition at line 21 of file process.h.


Member Data Documentation

processId process::m_id [protected]
 

the id of the process

Definition at line 78 of file process.h.

Referenced by clean(), getId(), virtualMachine::kill(), and virtualMachine::shouldBeTerminated().

program* process::m_pProgram [protected]
 

pointer to the program being executed

Definition at line 72 of file process.h.

Referenced by clean(), getProgram(), isTerminated(), and virtualMachine::run().

uInt process::m_threadCnt [protected]
 

the number of active threads

Definition at line 75 of file process.h.

Referenced by clean(), getNumThreads(), isTerminated(), killThread(), and spawnThread().


The documentation for this class was generated from the following files:
Generated on Sun Mar 6 22:12:35 2005 for virtualMachine03 by doxygen 1.3.7