diff --git a/src/runtime2/inbox.rs b/src/runtime2/inbox.rs index e98a76f7fc9be937aa92ed6b03eb8907fdc9bc37..a26cf17373de3aab4a0c652c59288d1e4934cab1 100644 --- a/src/runtime2/inbox.rs +++ b/src/runtime2/inbox.rs @@ -208,36 +208,4 @@ pub struct Message { pub sending_connector: ConnectorId, pub receiving_port: PortIdLocal, // may be invalid (in case of messages targeted at the connector) pub contents: MessageContents, -} - -/// The public inbox of a connector. The thread running the connector that owns -/// this inbox may retrieved from it. Non-owning threads may only put new -/// messages inside of it. -// TODO: @Optimize, lazy concurrency. Probably ringbuffer with read/write heads. -// Should behave as a MPSC queue. -pub struct PublicInbox { - messages: Mutex>, -} - -impl PublicInbox { - pub fn new() -> Self { - Self{ - messages: Mutex::new(VecDeque::new()), - } - } - - pub fn insert_message(&self, message: MessageFancy) { - let mut lock = self.messages.lock().unwrap(); - lock.push_back(message); - } - - pub fn take_message(&self) -> Option { - let mut lock = self.messages.lock().unwrap(); - return lock.pop_front(); - } - - pub fn is_empty(&self) -> bool { - let lock = self.messages.lock().unwrap(); - return lock.is_empty(); - } } \ No newline at end of file