complete threads till 06

This commit is contained in:
2025-04-15 16:25:01 +05:30
parent 9bc063a05b
commit 4fbee2d894
9 changed files with 67 additions and 19 deletions

View File

@@ -1,10 +1,13 @@
use std::sync::mpsc::{Receiver, Sender};
use data::TicketDraft;
use store::TicketStore;
pub mod data;
pub mod store;
pub enum Command {
Insert(todo!()),
Insert(TicketDraft),
}
// Start the system by spawning the server thread.
@@ -20,4 +23,14 @@ pub fn launch() -> Sender<Command> {
// Enter a loop: wait for a command to show up in
// the channel, then execute it, then start waiting
// for the next command.
pub fn server(receiver: Receiver<Command>) {}
pub fn server(receiver: Receiver<Command>) {
let mut tickStor = TicketStore::new();
'aLoop: loop {
let command = receiver.recv().ok().unwrap();
match command {
Command::Insert(a) => {
tickStor.add_ticket(a);
}
}
}
}