mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-25 08:54:50 +01:00
fix: lock for receiving changes
must never have more than 1 callback consuming
This commit is contained in:
parent
8a4e6e828a
commit
3ee546be4d
1 changed files with 4 additions and 0 deletions
|
@ -112,7 +112,10 @@ local function attach(name, opts)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local lock = false
|
||||||
local async = vim.loop.new_async(vim.schedule_wrap(function ()
|
local async = vim.loop.new_async(vim.schedule_wrap(function ()
|
||||||
|
if lock then return end
|
||||||
|
lock = true
|
||||||
while true do
|
while true do
|
||||||
local event = controller:try_recv():await()
|
local event = controller:try_recv():await()
|
||||||
if event == nil then break end
|
if event == nil then break end
|
||||||
|
@ -132,6 +135,7 @@ local function attach(name, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
lock = false
|
||||||
end))
|
end))
|
||||||
|
|
||||||
local remote_content = controller:content():await()
|
local remote_content = controller:content():await()
|
||||||
|
|
Loading…
Reference in a new issue