Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Receiver Class Reference

A receiver. More...

#include <receiver.h>

Inheritance diagram for Receiver:

Context Thread Kernel_thread List of all members.

Public Member Functions

bool sender_ok (const Sender *sender) const
 Return whether the receiver is ready to accept a message from the given sender.
void deny_lipc ()
 Dummy function, needed to keep code in Thread generic.
void deny_lipc_snd ()
 Dummy function, needed to keep code in Thread generic.
Sys_ipc_framercv_regs () const
 Return a reference to receiver's IPC registers.
void set_pagein_request (Address address, Mword error_code, Thread *notify)
 Send page-in request.
bool in_long_ipc (Sender *sender) const
 Return whether the receiver is still engaged in a long IPC with a sender.
Sender ** sender_list ()
 Head of sender list.
void set_timeout (Timeout *t)
void reset_timeout ()
int ipc_try_lock (const Sender *sender)
 Try to start an IPC handshake with this receiver.
void ipc_init (Sender *sender)
 Initiates a receiving IPC and updates the ipc partner.
void ipc_unlock ()
 Unlock a receiver locked with ipc_try_lock().

Protected Member Functions

void maybe_enable_lipc ()
 Dummy function, needed to keep code in Thread generic.
void allow_lipc ()
 Dummy function, needed to keep code in Thread generic.
 Receiver (Thread_lock *thread_lock, Space *space, unsigned short prio, unsigned short mcp, Unsigned64 quantum)
 Constructor.
Senderpartner () const
 IPC partner (sender).
void restore_receiver_state (Sender *partner, Sys_ipc_frame *regs)
 Restore a saved IPC state to restart a suspended IPC.
void save_receiver_state (Sender **out_partner, Sys_ipc_frame **out_regs)
 Save IPC state to allow later restart a suspended IPC.
void clear_pagein_request ()
 Reset the current page-in request.
Address pagein_addr () const
 Return current page-in address.
Mword pagein_error_code () const
 Return current page-in error code.
Threadpagein_applicant ()
 Return current requestor of a page-in.
void set_rcv_regs (Sys_ipc_frame *regs)
void set_partner (Sender *partner)
 Set the IPC partner (sender).
void setup_receiver (Sender *sender, Sys_ipc_frame *regs)
 Convenience function: Set up a receiving IPC and add the corresponding state.
unsigned setup_receiver_state (Sender *sender, Sys_ipc_frame *regs, bool=false)
 Set up a receiving IPC.
void reload_ip_sp_from_utcb ()
 Dummy function, needed to keep code in Thread generic.

Protected Attributes

Timeout_timeout

Private Attributes

Sender_partner
Sys_ipc_frame_rcv_regs
Address _pagein_addr
Mword _pagein_error_code
Thread_pagein_applicant
Sender_sender_first

Detailed Description

A receiver.

This is a role class, and real receiver's must inherit from it. The protected interface is intended for the receiver, and the public interface is intended for the sender.

The only reason this class inherits from Context is to force a specific layout for Thread. Otherwise, Receiver could just embed or reference a Context.


Constructor & Destructor Documentation

Receiver::Receiver Thread_lock thread_lock,
Space space,
unsigned short  prio,
unsigned short  mcp,
Unsigned64  quantum
[inline, protected]
 

Constructor.

Parameters:
thread_lock the lock used for synchronizing access to this receiver
space_context the space context


Member Function Documentation

void Receiver::allow_lipc  )  [inline, protected]
 

Dummy function, needed to keep code in Thread generic.

void Receiver::clear_pagein_request  )  [inline, protected]
 

Reset the current page-in request.

void Receiver::deny_lipc  )  [inline]
 

Dummy function, needed to keep code in Thread generic.

void Receiver::deny_lipc_snd  )  [inline]
 

Dummy function, needed to keep code in Thread generic.

bool Receiver::in_long_ipc Sender sender  )  const [inline]
 

Return whether the receiver is still engaged in a long IPC with a sender.

Parameters:
sender a sender
Returns:
true if receiver is in long IPC with sender

void Receiver::ipc_init Sender sender  )  [inline]
 

Initiates a receiving IPC and updates the ipc partner.

Parameters:
sender the sender that wants to establish an IPC handshake

int Receiver::ipc_try_lock const Sender sender  )  [inline]
 

Try to start an IPC handshake with this receiver.

Check the receiver's state, checks if the receiver is acceptable at this time, and if OK, /lock/ the receiver and copy the sender's ID to the receiver.

Parameters:
sender the sender that wants to establish an IPC handshake
Returns:
0 for success, -1 in case of a transient failure, an IPC error code if an error occurs.

void Receiver::ipc_unlock  )  [inline]
 

Unlock a receiver locked with ipc_try_lock().

void Receiver::maybe_enable_lipc  )  [inline, protected]
 

Dummy function, needed to keep code in Thread generic.

Address Receiver::pagein_addr  )  const [inline, protected]
 

Return current page-in address.

Returns -1 if there is no page-in request.

Thread * Receiver::pagein_applicant  )  [inline, protected]
 

Return current requestor of a page-in.

Returns:
owner of current page-in request

Mword Receiver::pagein_error_code  )  const [inline, protected]
 

Return current page-in error code.

Returns 0 if there is no page-in request.

Sender * Receiver::partner  )  const [inline, protected]
 

IPC partner (sender).

Returns:
sender of ongoing or previous IPC operation

Sys_ipc_frame * Receiver::rcv_regs  )  const [inline]
 

Return a reference to receiver's IPC registers.

Senders call this function to poke values into the receiver's register set.

Precondition:
state() & Thread_ipc_receiving_mask
Returns:
pointer to receiver's IPC registers.

void Receiver::reload_ip_sp_from_utcb  )  [inline, protected]
 

Dummy function, needed to keep code in Thread generic.

void Receiver::reset_timeout  )  [inline]
 

void Receiver::restore_receiver_state Sender partner,
Sys_ipc_frame regs
[inline, protected]
 

Restore a saved IPC state to restart a suspended IPC.

Parameters:
partner sender of suspended receive operation
regs registers of suspended receive operation

void Receiver::save_receiver_state Sender **  out_partner,
Sys_ipc_frame **  out_regs
[inline, protected]
 

Save IPC state to allow later restart a suspended IPC.

Parameters:
out_partner returns sender of suspended receive operation
out_regs returns pointer to IPC regs of suspended receive operation

Sender ** Receiver::sender_list  )  [inline]
 

Head of sender list.

Returns:
a reference to the receiver's list of senders

bool Receiver::sender_ok const Sender sender  )  const [inline]
 

Return whether the receiver is ready to accept a message from the given sender.

Parameters:
sender thread that wants to send a message to this receiver
Returns:
true if receiver is in correct state to accept a message right now (open wait, or closed wait and waiting for sender).

void Receiver::set_pagein_request Address  address,
Mword  error_code,
Thread notify
[inline]
 

Send page-in request.

Senders call this function to request that the receiver pages in memory at a specific address. Afterwards, senders should go to sleep. The receiver will wake them up later.

Parameters:
address virtual address that should be paged in
notify the sender thread that wants to be notified after the page has been paged in
Postcondition:
state() & Thread_ready

void Receiver::set_partner Sender partner  )  [inline, protected]
 

Set the IPC partner (sender).

Parameters:
partner IPC partner

void Receiver::set_rcv_regs Sys_ipc_frame regs  )  [inline, protected]
 

void Receiver::set_timeout Timeout t  )  [inline]
 

void Receiver::setup_receiver Sender sender,
Sys_ipc_frame regs
[inline, protected]
 

Convenience function: Set up a receiving IPC and add the corresponding state.

Parameters:
sender 0 means any sender OK, otherwise only specified sender maysnd
regs register set that should be used as IPC registers
Returns:
state bits that should be added to receiver's state word.
Postcondition:
(sender == 0 || partner() == sender) && (rcv_regs() == regs) && (state & Thread_receiving)

unsigned Receiver::setup_receiver_state Sender sender,
Sys_ipc_frame regs,
bool  = false
[inline, protected]
 

Set up a receiving IPC.

Parameters:
sender 0 means any sender OK, otherwise only specified sender may send
regs register set that should be used as IPC registers
Returns:
state bits that should be added to receiver's state word.
Postcondition:
(sender == 0 || partner() == sender) && (receive_regs() == regs) && (retval == Thread_receiving)


Member Data Documentation

Address Receiver::_pagein_addr [private]
 

Thread* Receiver::_pagein_applicant [private]
 

Mword Receiver::_pagein_error_code [private]
 

Sender* Receiver::_partner [private]
 

Sys_ipc_frame* Receiver::_rcv_regs [private]
 

Sender* Receiver::_sender_first [private]
 

Timeout* Receiver::_timeout [protected]
 


The documentation for this class was generated from the following file:
Generated on Mon Sep 26 14:20:17 2005 for Fiasco by  doxygen 1.4.2