diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2016-06-11 12:14:58 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-06-11 12:14:58 -0400 |
| commit | f0c1a06792586d8373639ad2e9d34de6594cece3 (patch) | |
| tree | 6612b88611deb097cabe19c0cfec48273a696423 /src/nvim/event/loop.h | |
| parent | 290215364898fbd3a660be6c0642377c47398619 (diff) | |
| parent | 244967bff918cbde43eea823c1bf0fa86d566623 (diff) | |
| download | rneovim-f0c1a06792586d8373639ad2e9d34de6594cece3.tar.gz rneovim-f0c1a06792586d8373639ad2e9d34de6594cece3.tar.bz2 rneovim-f0c1a06792586d8373639ad2e9d34de6594cece3.zip | |
Merge #4908 from ZyX-I/clint-checks-2
Add more clint checks
Diffstat (limited to 'src/nvim/event/loop.h')
| -rw-r--r-- | src/nvim/event/loop.h | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/nvim/event/loop.h b/src/nvim/event/loop.h index 0c1fcb5ed9..407aa4245f 100644 --- a/src/nvim/event/loop.h +++ b/src/nvim/event/loop.h @@ -26,43 +26,43 @@ typedef struct loop { int recursive; } Loop; -#define CREATE_EVENT(queue, handler, argc, ...) \ - do { \ - if (queue) { \ - queue_put((queue), (handler), argc, __VA_ARGS__); \ - } else { \ - void *argv[argc] = {__VA_ARGS__}; \ - (handler)(argv); \ - } \ +#define CREATE_EVENT(queue, handler, argc, ...) \ + do { \ + if (queue) { \ + queue_put((queue), (handler), argc, __VA_ARGS__); \ + } else { \ + void *argv[argc] = { __VA_ARGS__ }; \ + (handler)(argv); \ + } \ } while (0) // Poll for events until a condition or timeout -#define LOOP_PROCESS_EVENTS_UNTIL(loop, queue, timeout, condition) \ - do { \ - int remaining = timeout; \ - uint64_t before = (remaining > 0) ? os_hrtime() : 0; \ - while (!(condition)) { \ - LOOP_PROCESS_EVENTS(loop, queue, remaining); \ - if (remaining == 0) { \ - break; \ - } else if (remaining > 0) { \ - uint64_t now = os_hrtime(); \ - remaining -= (int) ((now - before) / 1000000); \ - before = now; \ - if (remaining <= 0) { \ - break; \ - } \ - } \ - } \ +#define LOOP_PROCESS_EVENTS_UNTIL(loop, queue, timeout, condition) \ + do { \ + int remaining = timeout; \ + uint64_t before = (remaining > 0) ? os_hrtime() : 0; \ + while (!(condition)) { \ + LOOP_PROCESS_EVENTS(loop, queue, remaining); \ + if (remaining == 0) { \ + break; \ + } else if (remaining > 0) { \ + uint64_t now = os_hrtime(); \ + remaining -= (int) ((now - before) / 1000000); \ + before = now; \ + if (remaining <= 0) { \ + break; \ + } \ + } \ + } \ } while (0) -#define LOOP_PROCESS_EVENTS(loop, queue, timeout) \ - do { \ - if (queue && !queue_empty(queue)) { \ - queue_process_events(queue); \ - } else { \ - loop_poll_events(loop, timeout); \ - } \ +#define LOOP_PROCESS_EVENTS(loop, queue, timeout) \ + do { \ + if (queue && !queue_empty(queue)) { \ + queue_process_events(queue); \ + } else { \ + loop_poll_events(loop, timeout); \ + } \ } while (0) |