fix(dirmonitor): deadlock if error handler jumps somewhere else (#1647)

* fix: deadlock if error handler jumps somewhere else

* docs(dirmonitor): fix wrong data type in error callback

* docs(dirmonitor): clarify coroutines and deadlocks

* docs(dirmonitor): wording

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
This commit is contained in:
Takase
2023-10-24 20:16:52 +08:00
committed by takase1121
co-authored by Guldoman
parent 4005a46144
commit 5d53b13cf4
3 changed files with 28 additions and 4 deletions
+5 -1
View File
@@ -45,10 +45,14 @@ function dirmonitor:unwatch(fd_or_path) end
---edited, removed or added. A file descriptor will be passed to the
---callback in "multiple" mode or a path in "single" mode.
---
---If an error occurred during the callback execution, the error callback will be called with the error object.
---This callback should not manipulate coroutines to avoid deadlocks.
---
---@param callback dirmonitor.callback
---@param error_callback fun(error: any): nil
---
---@return boolean? changes True when changes were detected.
function dirmonitor:check(callback) end
function dirmonitor:check(callback, error_callback) end
---
---Get the working mode for the current file system monitoring backend.