specifically, i have one thread that will submit commands like this
// Means there are no other reload config job being queued
if self
.config_mutex
.compare_exchange(0, 1, Ordering::Relaxed, Ordering::Relaxed)
.is_ok()
{
let _ = self.event_sink.submit_command(
LAPCE_UI_COMMAND,
LapceUICommand::ReloadConfig,
Target::Auto,
);
} else {
// If not, just try to increment by 1 if and only if there's only 1 other job
let _ = self
.config_mutex
.compare_exchange(1, 2, Ordering::Relaxed, Ordering::Relaxed);
}