Expand description
IPC ping-pong test (Port-based) + MPMC SyncChannel test (IPC-02).
ยงPort test (Task A / Task B)
Creates two kernel tasks that communicate via an IPC port:
- Task A (sender): creates a port, stores its ID in a shared static, then sends a message with msg_type=42.
- Task B (receiver): spins until the port ID is published, then calls
recv()(which blocks if the message hasnโt arrived yet), logs the result, and verifies correctness.
ยงChannel test (IPC-02)
Three kernel tasks share a channel::<u64>(4):
- Producer-1: sends 1, 2, 3 then drops its Sender endpoint.
- Producer-2: yields once (so the consumer may block), then sends 4, 5.
- Consumer: blocks on
recv()until both producers disconnect, verifies it received exactly 5 messages.
Staticsยง
- CHAN_RX ๐
- CHAN_
TX1 ๐ - Endpoint slots: each task takes its endpoint out (Option::take) once.
SpinLock<Option
>: Sync when T: Send : no private-field access needed. - CHAN_
TX2 ๐ - SEM_
TEST_ ๐ID - SEM_
TEST_ ๐RESULT - TEST_
PORT_ ๐ID - Shared port ID between the two test tasks. 0 = not yet created.
Functionsยง
- chan_
consumer_ ๐main - Consumer: drains all messages; expects exactly 5, then Disconnected.
- chan_
producer1_ ๐main - Producer-1: sends 1, 2, 3 then drops Sender (decrements sender_count).
- chan_
producer2_ ๐main - Producer-2: yields first so the consumer blocks, then sends 4, 5.
- create_
channel_ test_ tasks - Schedule the three channel test tasks.
- create_
ipc_ 04_ 05_ test_ task - Creates ipc 04 05 test task.
- create_
ipc_ test_ tasks - Create and schedule the IPC test tasks.
- ipc_
04_ ๐05_ main - Performs the ipc 04 05 main operation.
- ipc_
receiver_ ๐main - Receiver task: waits for port ID, calls recv (blocks if needed), logs result.
- ipc_
sender_ ๐main - Sender task: creates a port, publishes ID, sends a test message, then exits.
- sem_
poster_ ๐main - Performs the sem poster main operation.