mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-21 15:04:52 +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,
|
||||
})
|
||||
|
||||
local lock = false
|
||||
local async = vim.loop.new_async(vim.schedule_wrap(function ()
|
||||
if lock then return end
|
||||
lock = true
|
||||
while true do
|
||||
local event = controller:try_recv():await()
|
||||
if event == nil then break end
|
||||
|
@ -132,6 +135,7 @@ local function attach(name, opts)
|
|||
end
|
||||
end
|
||||
end
|
||||
lock = false
|
||||
end))
|
||||
|
||||
local remote_content = controller:content():await()
|
||||
|
|
Loading…
Reference in a new issue