event: Remove direct calls to uv_run from job.c/shell.c

This commit is contained in:
Thiago de Arruda
2014-10-21 12:27:25 -03:00
parent 276ac99350
commit b6c9883169
2 changed files with 6 additions and 5 deletions

View File

@@ -97,7 +97,7 @@ void job_teardown(void)
// their status with `wait` or handling SIGCHLD. libuv does that // their status with `wait` or handling SIGCHLD. libuv does that
// automatically (and then calls `exit_cb`) but we have to give it a chance // automatically (and then calls `exit_cb`) but we have to give it a chance
// by running the loop one more time // by running the loop one more time
uv_run(uv_default_loop(), UV_RUN_NOWAIT); event_poll(0);
// Prepare to start shooting // Prepare to start shooting
for (i = 0; i < MAX_RUNNING_JOBS; i++) { for (i = 0; i < MAX_RUNNING_JOBS; i++) {
@@ -107,8 +107,8 @@ void job_teardown(void)
while (job && is_alive(job) && remaining_tries--) { while (job && is_alive(job) && remaining_tries--) {
os_delay(50, 0); os_delay(50, 0);
// Acknowledge child exits // Acknowledge child exits
uv_run(uv_default_loop(), UV_RUN_NOWAIT); event_poll(0);
// It's possible that the uv_run call removed the job from the table, // It's possible that the event_poll call removed the job from the table,
// reset 'job' so the next iteration won't run in that case. // reset 'job' so the next iteration won't run in that case.
job = table[i]; job = table[i];
} }
@@ -118,7 +118,7 @@ void job_teardown(void)
} }
} }
// Last run to ensure all children were removed // Last run to ensure all children were removed
uv_run(uv_default_loop(), UV_RUN_NOWAIT); event_poll(0);
} }
/// Tries to start a new job. /// Tries to start a new job.

View File

@@ -8,6 +8,7 @@
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/lib/kvec.h" #include "nvim/lib/kvec.h"
#include "nvim/log.h" #include "nvim/log.h"
#include "nvim/os/event.h"
#include "nvim/os/job.h" #include "nvim/os/job.h"
#include "nvim/os/rstream.h" #include "nvim/os/rstream.h"
#include "nvim/os/shell.h" #include "nvim/os/shell.h"
@@ -213,7 +214,7 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
// Keep running the loop until all three handles are completely closed // Keep running the loop until all three handles are completely closed
while (pdata.exited < expected_exits) { while (pdata.exited < expected_exits) {
uv_run(uv_default_loop(), UV_RUN_ONCE); event_poll(0);
if (got_int) { if (got_int) {
// Forward SIGINT to the shell // Forward SIGINT to the shell