Skip to content

Commit

Permalink
remove thread.reset
Browse files Browse the repository at this point in the history
  • Loading branch information
actboy168 committed May 7, 2024
1 parent efdc469 commit 100fdcc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 27 deletions.
12 changes: 0 additions & 12 deletions binding/lua_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,6 @@ namespace bee::lua_thread {
return g_errlog.pop(L);
}

static int lreset(lua_State* L) {
lua_rawgetp(L, LUA_REGISTRYINDEX, &THREADID);
int threadid = (int)lua_tointeger(L, -1);
lua_pop(L, 1);
if (threadid != 0) {
return luaL_error(L, "reset must call from main thread");
}
g_thread_id = 0;
return 0;
}

static int lwait(lua_State* L) {
thread_handle th = lua::checklightud<thread_handle>(L, 1);
thread_wait(th);
Expand Down Expand Up @@ -171,7 +160,6 @@ namespace bee::lua_thread {
{ "sleep", lsleep },
{ "thread", lthread },
{ "errlog", lerrlog },
{ "reset", lreset },
{ "wait", lwait },
{ "setname", lsetname },
{ "preload_module", lua::preload_module },
Expand Down
2 changes: 0 additions & 2 deletions test/test_channel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ end
function test_channel:test_pop_3()
channel.reset()
assertNotThreadError()
thread.reset()
local req = channel.create "testReq"
local res = channel.create "testRes"
local thd = thread.thread [[
Expand Down Expand Up @@ -153,7 +152,6 @@ end
function test_channel:test_fd()
channel.reset()
assertNotThreadError()
thread.reset()
local req = channel.create "testReq"
local res = channel.create "testRes"
local thd = thread.thread [[
Expand Down
13 changes: 0 additions & 13 deletions test/test_thread.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ end
function test_thread:test_id_2()
assertNotThreadError()
lt.assertEquals(thread.id, 0)
thread.reset()
lt.assertEquals(thread.id, 0)
local thd = createThread [[
local thread = require "bee.thread"
assert(thread.id ~= 0)
Expand All @@ -103,17 +101,6 @@ function test_thread:test_id_2()
assertNotThreadError()
end

function test_thread:test_reset()
assertNotThreadError()
local thd = createThread [[
local thread = require "bee.thread"
thread.reset()
]]
thread.wait(thd)
assertHasThreadError("reset must call from main thread")
assertNotThreadError()
end

function test_thread:test_sleep()
local t1 = time.monotonic()
thread.sleep(1)
Expand Down

0 comments on commit 100fdcc

Please sign in to comment.