mirror of
https://github.com/chatmail/core.git
synced 2026-04-25 01:16:29 +03:00
wip: stop sharing the inbox across threads
This commit is contained in:
@@ -149,12 +149,14 @@ fn start_threads(c: Arc<RwLock<Context>>) {
|
||||
|
||||
let ctx = c.clone();
|
||||
let handle_imap = std::thread::spawn(move || loop {
|
||||
let mut inbox = ctx.read().unwrap().create_inbox();
|
||||
|
||||
while_running!({
|
||||
perform_imap_jobs(&ctx.read().unwrap());
|
||||
perform_imap_fetch(&ctx.read().unwrap());
|
||||
perform_imap_jobs(&ctx.read().unwrap(), &mut inbox);
|
||||
perform_imap_fetch(&ctx.read().unwrap(), &mut inbox);
|
||||
while_running!({
|
||||
let context = ctx.read().unwrap();
|
||||
perform_imap_idle(&context);
|
||||
perform_imap_idle(&context, &mut inbox);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -202,7 +204,7 @@ fn stop_threads(context: &Context) {
|
||||
println!("Stopping threads");
|
||||
IS_RUNNING.store(false, Ordering::Relaxed);
|
||||
|
||||
interrupt_imap_idle(context);
|
||||
// interrupt_imap_idle(context);
|
||||
interrupt_mvbox_idle(context);
|
||||
interrupt_sentbox_idle(context);
|
||||
interrupt_smtp_idle(context);
|
||||
@@ -457,7 +459,8 @@ unsafe fn handle_cmd(line: &str, ctx: Arc<RwLock<Context>>) -> Result<ExitResult
|
||||
if HANDLE.clone().lock().unwrap().is_some() {
|
||||
println!("imap-jobs are already running in a thread.");
|
||||
} else {
|
||||
perform_imap_jobs(&ctx.read().unwrap());
|
||||
// perform_imap_jobs(&ctx.read().unwrap());
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
"configure" => {
|
||||
|
||||
Reference in New Issue
Block a user