mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
use tinsert instead of table.insert
This commit is contained in:
@@ -7,6 +7,7 @@ local pairs = pairs
|
|||||||
local pcall = pcall
|
local pcall = pcall
|
||||||
local table = table
|
local table = table
|
||||||
local tremove = table.remove
|
local tremove = table.remove
|
||||||
|
local tinsert = table.insert
|
||||||
|
|
||||||
local profile = require "skynet.profile"
|
local profile = require "skynet.profile"
|
||||||
|
|
||||||
@@ -90,13 +91,13 @@ local function _error_dispatch(error_session, error_source)
|
|||||||
end
|
end
|
||||||
for session, srv in pairs(watching_session) do
|
for session, srv in pairs(watching_session) do
|
||||||
if srv == error_source then
|
if srv == error_source then
|
||||||
table.insert(error_queue, session)
|
tinsert(error_queue, session)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- capture an error for error_session
|
-- capture an error for error_session
|
||||||
if watching_session[error_session] then
|
if watching_session[error_session] then
|
||||||
table.insert(error_queue, error_session)
|
tinsert(error_queue, error_session)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -480,7 +481,7 @@ end
|
|||||||
|
|
||||||
function skynet.wakeup(token)
|
function skynet.wakeup(token)
|
||||||
if sleep_session[token] then
|
if sleep_session[token] then
|
||||||
table.insert(wakeup_queue, token)
|
tinsert(wakeup_queue, token)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -527,7 +528,7 @@ function skynet.fork(func,...)
|
|||||||
local args = { ... }
|
local args = { ... }
|
||||||
co = co_create(function() func(table.unpack(args,1,n)) end)
|
co = co_create(function() func(table.unpack(args,1,n)) end)
|
||||||
end
|
end
|
||||||
table.insert(fork_queue, co)
|
tinsert(fork_queue, co)
|
||||||
return co
|
return co
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -689,7 +690,7 @@ function skynet.init(f, name)
|
|||||||
if init_func == nil then
|
if init_func == nil then
|
||||||
f()
|
f()
|
||||||
else
|
else
|
||||||
table.insert(init_func, f)
|
tinsert(init_func, f)
|
||||||
if name then
|
if name then
|
||||||
assert(type(name) == "string")
|
assert(type(name) == "string")
|
||||||
assert(init_func[name] == nil)
|
assert(init_func[name] == nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user