Skip to content

Commit 3328f28

Browse files
committed
fix thread issue
1 parent 184f134 commit 3328f28

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ encoding_rs = "0.8"
1212
tokio = { version = "1.40.0", features = ["full"] }
1313
notify = { version = "6.1.1", features = ["serde"] }
1414

15-
[target.'cfg(windows)'.dependencies]
16-
1715
[build-dependencies]
1816
cc = "1.0"
1917
glob = "0.3.0"

src/bee/lua_thread.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,16 @@ fn bee_thread_newchannel(_: &Lua, name: String) -> LuaResult<()> {
127127
Ok(())
128128
}
129129

130-
fn bee_thread_channel(lua: &Lua, name: &str) -> LuaResult<LuaChannel> {
131-
if let Some(channel) = luaChannelMgr.lock().unwrap().get_channel(name) {
130+
fn bee_thread_channel(_: &Lua, name: &str) -> LuaResult<LuaChannel> {
131+
let mut mgr = luaChannelMgr.lock().unwrap();
132+
if let Some(channel) = mgr.get_channel(name) {
132133
Ok(channel)
133134
} else {
134-
bee_thread_newchannel(lua, name.to_string())?;
135-
Ok(luaChannelMgr.lock().unwrap().get_channel(name).unwrap())
135+
mgr.new_channel(name.to_string());
136+
if let Some(channel) = mgr.get_channel(name) {
137+
return Ok(channel);
138+
}
139+
Err(mlua::Error::RuntimeError("Channel not found".to_string()))
136140
}
137141
}
138142

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ async fn main() -> LuaResult<()> {
7070
)?;
7171

7272
build_args(&lua);
73-
let main = lua.load(path::Path::new("resources/testmain.lua"));
73+
let main = lua.load(path::Path::new("resources/main.lua"));
7474
main.call_async(()).await?;
7575
Ok(())
7676
}

0 commit comments

Comments
 (0)