diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/os/fs.c | 5 | ||||
| -rw-r--r-- | src/nvim/tui/tui.c | 1 | ||||
| -rw-r--r-- | src/nvim/ui_bridge.c | 19 | ||||
| -rw-r--r-- | src/nvim/ui_bridge.h | 4 | 
4 files changed, 25 insertions, 4 deletions
| diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 05f0f53c63..3fb00eb24e 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -140,9 +140,8 @@ static bool is_executable(const char_u *name)  static bool is_executable_in_path(const char_u *name, char_u **abspath)    FUNC_ATTR_NONNULL_ARG(1)  { -  const char *path = getenv("PATH"); -  // PATH environment variable does not exist or is empty. -  if (path == NULL || *path == NUL) { +  const char *path = os_getenv("PATH"); +  if (path == NULL) {      return false;    } diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index c5f2950e62..02efa1f8df 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -219,6 +219,7 @@ static void tui_main(UIBridgeData *bridge, UI *ui)      loop_poll_events(&tui_loop, -1);    } +  ui_bridge_stopped(bridge);    term_input_destroy(&data->input);    signal_watcher_stop(&data->cont_handle);    signal_watcher_close(&data->cont_handle, NULL); diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c index 836339a887..359fffe3bf 100644 --- a/src/nvim/ui_bridge.c +++ b/src/nvim/ui_bridge.c @@ -74,6 +74,13 @@ UI *ui_bridge_attach(UI *ui, ui_main_fn ui_main, event_scheduler scheduler)    return &rv->bridge;  } +void ui_bridge_stopped(UIBridgeData *bridge) +{ +  uv_mutex_lock(&bridge->mutex); +  bridge->stopped = true; +  uv_mutex_unlock(&bridge->mutex); +} +  static void ui_thread_run(void *data)  {    UIBridgeData *bridge = data; @@ -82,8 +89,18 @@ static void ui_thread_run(void *data)  static void ui_bridge_stop(UI *b)  { -  UI_CALL(b, stop, 1, b);    UIBridgeData *bridge = (UIBridgeData *)b; +  bool stopped = bridge->stopped = false; +  UI_CALL(b, stop, 1, b); +  for (;;) { +    uv_mutex_lock(&bridge->mutex); +    stopped = bridge->stopped; +    uv_mutex_unlock(&bridge->mutex); +    if (stopped) { +      break; +    } +    loop_poll_events(&loop, 10); +  }    uv_thread_join(&bridge->ui_thread);    uv_mutex_destroy(&bridge->mutex);    uv_cond_destroy(&bridge->cond); diff --git a/src/nvim/ui_bridge.h b/src/nvim/ui_bridge.h index 76e9e27989..31b9a69216 100644 --- a/src/nvim/ui_bridge.h +++ b/src/nvim/ui_bridge.h @@ -22,6 +22,10 @@ struct ui_bridge_data {    // the call returns. This flag is used as a condition for the main    // thread to continue.    bool ready; +  // When a stop request is sent from the main thread, it must wait until the UI +  // thread finishes handling all events. This flag is set by the UI thread as a +  // signal that it will no longer send messages to the main thread. +  bool stopped;  };  #define CONTINUE(b)                                                    \ | 
