lua::thread: Remove RUNNING static
This static is only ever written to, because the previous commits
removed all readers.
@@ -7,7 +7,6 @@ use std::path::Path;
use std::fmt::{Debug, Formatter, Result as FmtResult};
use std::cell::{Cell, RefCell};
use std::sync::RwLock;
-use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{channel, Sender, Receiver};
use std::io::Read;
@@ -38,10 +37,6 @@ thread_local! {
}
lazy_static! {
- /// Sends requests to the Lua thread
- /// Whether the Lua thread is currently running
- static ref RUNNING: AtomicBool = AtomicBool::new(false);
-
/// Requests to update the registry state from Lua
static ref REGISTRY_QUEUE: RwLock<Vec<String>> = RwLock::new(vec![]);
}
@@ -147,7 +142,6 @@ pub fn send(query: LuaQuery) -> Result<Receiver<LuaResponse>, LuaSendError> {
/// Initialize the Lua thread.
pub fn init() {
info!("Starting Lua thread...");
- RUNNING.store(true, Ordering::Relaxed);
let _lua_handle = thread::Builder::new()
.name("Lua thread".to_string())
.spawn(|| main_loop());
@@ -253,7 +247,6 @@ fn main_loop() {
.expect("Could not register lua libraries");
lua_init();
MAIN_LOOP.with(|main_loop| main_loop.borrow().run());
- RUNNING.store(false, Ordering::Relaxed);
}
/// Handle each LuaQuery option sent to the thread
@@ -266,7 +259,6 @@ fn handle_message(request: LuaMessage, lua: &mut rlua::Lua) -> bool {
warn!("Lua termination callback returned an error: {:?}", error);
warn!("However, termination will continue");
}
- RUNNING.store(false, Ordering::Relaxed);
thread_send(request.reply, LuaResponse::Pong);
info!("Lua thread terminating!");
