aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/event/loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/event/loop.c')
-rw-r--r--src/nvim/event/loop.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/nvim/event/loop.c b/src/nvim/event/loop.c
index ab2524c1a9..d61666e6d4 100644
--- a/src/nvim/event/loop.c
+++ b/src/nvim/event/loop.c
@@ -1,6 +1,3 @@
-// This is an open source non-commercial project. Dear PVS-Studio, please check
-// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
-
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
@@ -20,6 +17,7 @@ void loop_init(Loop *loop, void *data)
{
uv_loop_init(&loop->uv);
loop->recursive = 0;
+ loop->closing = false;
loop->uv.data = loop;
loop->children = kl_init(WatcherPtr);
loop->events = multiqueue_new_parent(loop_on_put, loop);
@@ -61,9 +59,9 @@ bool loop_uv_run(Loop *loop, int64_t ms, bool once)
mode = UV_RUN_NOWAIT;
}
- do { // -V1044
+ do {
uv_run(&loop->uv, mode);
- } while (ms > 0 && !once && !*timeout_expired); // -V560
+ } while (ms > 0 && !once && !*timeout_expired);
if (ms > 0) {
uv_timer_stop(&loop->poll_timer);
@@ -152,6 +150,7 @@ static void loop_walk_cb(uv_handle_t *handle, void *arg)
bool loop_close(Loop *loop, bool wait)
{
bool rv = true;
+ loop->closing = true;
uv_mutex_destroy(&loop->mutex);
uv_close((uv_handle_t *)&loop->children_watcher, NULL);
uv_close((uv_handle_t *)&loop->children_kill_timer, NULL);
@@ -163,7 +162,7 @@ bool loop_close(Loop *loop, bool wait)
while (true) {
// Run the loop to tickle close-callbacks (which should then free memory).
// Use UV_RUN_NOWAIT to avoid a hang. #11820
- uv_run(&loop->uv, didstop ? UV_RUN_DEFAULT : UV_RUN_NOWAIT); // -V547
+ uv_run(&loop->uv, didstop ? UV_RUN_DEFAULT : UV_RUN_NOWAIT);
if ((uv_loop_close(&loop->uv) != UV_EBUSY) || !wait) {
break;
}