[][src]Module sunrise_kernel::ipc::port

IPC Port

A Port represents an endpoint which can be connected to, in order to establish a Session. It is split in two different part: ServerPort and ClientPort. The ClientPort has a connect operation, while a ServerPort has an accept operation.

Those work as a rendez-vous, meaning both operations wait for each-other: The connect operation blocks until a ServerPort calls accept. Similarly, the accept operation waits until a ClientPort connects. Once the two operation meet, a Session is created. The accept operation will return a ServerSession, while the connect operation returns a ClientSession.

Additionally, a ServerPort implements the Waitable trait, allowing it to be used with the event::wait function. This will wait until the associated ClientPort had its connect operation called.

let (server, client) = Port::new();
let client_sess = client.connect();
// In a separate thread
let server_sess = server.accept();

Structs

ClientPort

The client side of a Port.

IncomingConnection

Represents a connection request from the creator thread.

Port

An endpoint which can be connected to.

ServerPort

The server side of a Port.

Functions

new

Create a new Port pair. Those ports are linked to each-other: The server will receive connections from the client. A port may only have max_sessions sessions active at a given time.