moss.ipc
Class MMailBox

java.lang.Object
  extended by moss.ipc.MMailBox

public class MMailBox
extends java.lang.Object

this class provides mailbox style IPC. processes implicitly get mailboxes addressed by their PID.


Constructor Summary
MMailBox()
           
 
Method Summary
static void deadprocess(int pid)
          this is called by the kernel when a process exits.
static void finalinit()
          called to do final initialisation, in the context of the init-task
static void init_mailbox()
          initialises the MMailBox class -- should be called at system startup
static java.lang.Object recvmsg(int source, int dest, int type)
          called to receive a message.
static int sendmsg(int source, int dest, int type, java.lang.Object msg)
          called to send a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MMailBox

public MMailBox()
Method Detail

init_mailbox

public static void init_mailbox()
initialises the MMailBox class -- should be called at system startup


finalinit

public static void finalinit()
called to do final initialisation, in the context of the init-task


sendmsg

public static int sendmsg(int source,
                          int dest,
                          int type,
                          java.lang.Object msg)
called to send a message. This is always asynchronous -- i.e. this method will not block. It also provides a way for asynchronous Java threads (e.g. for graphics) to deliver messages to some MOSS process.

Parameters:
source - PID of source process (i.e. invoking process)
dest - PID of destination process
type - message type (application specific)
msg - object message (application specific)
Returns:
0 on success, otherwise -ve indicating error

recvmsg

public static java.lang.Object recvmsg(int source,
                                       int dest,
                                       int type)
called to receive a message. If no messages are available, the process will be descheduled until one becomes available.

Parameters:
source - PID of source process (or -1 for any)
dest - PID of receiving process (i.e. invoking process)
type - message type (application specific, or -1 for any)
Returns:
the object message or null if signalled

deadprocess

public static void deadprocess(int pid)
this is called by the kernel when a process exits. any messages queued for it are removed.

Parameters:
pid - terminating process ID