mirror of
https://github.com/neovim/neovim.git
synced 2026-02-10 06:21:49 +10:00
`lib/queue.h` implements a basic queue. `event/queue.c` implements a specialized data structure on top of lib/queue.h; it is not a "normal" queue. Rename the specialized multi-level queue implemented in event/queue.c to "multiqueue", to avoid confusion when reading the code. Before this change one can eventually notice that "macros (uppercase symbols) are for the normal queue, lowercase operations are for the multi-level queue", but that is unnecessary friction for new developers (or existing developers just visiting this part of the codebase).
62 lines
1.3 KiB
C
62 lines
1.3 KiB
C
#ifndef NVIM_EVENT_PROCESS_H
|
|
#define NVIM_EVENT_PROCESS_H
|
|
|
|
#include "nvim/event/loop.h"
|
|
#include "nvim/event/rstream.h"
|
|
#include "nvim/event/wstream.h"
|
|
|
|
typedef enum {
|
|
kProcessTypeUv,
|
|
kProcessTypePty
|
|
} ProcessType;
|
|
|
|
typedef struct process Process;
|
|
typedef void (*process_exit_cb)(Process *proc, int status, void *data);
|
|
typedef void (*internal_process_cb)(Process *proc);
|
|
|
|
struct process {
|
|
ProcessType type;
|
|
Loop *loop;
|
|
void *data;
|
|
int pid, status, refcount;
|
|
// set to the hrtime of when process_stop was called for the process.
|
|
uint64_t stopped_time;
|
|
char *cwd;
|
|
char **argv;
|
|
Stream *in, *out, *err;
|
|
process_exit_cb cb;
|
|
internal_process_cb internal_exit_cb, internal_close_cb;
|
|
bool closed, term_sent, detach;
|
|
MultiQueue *events;
|
|
};
|
|
|
|
static inline Process process_init(Loop *loop, ProcessType type, void *data)
|
|
{
|
|
return (Process) {
|
|
.type = type,
|
|
.data = data,
|
|
.loop = loop,
|
|
.events = NULL,
|
|
.pid = 0,
|
|
.status = 0,
|
|
.refcount = 0,
|
|
.stopped_time = 0,
|
|
.cwd = NULL,
|
|
.argv = NULL,
|
|
.in = NULL,
|
|
.out = NULL,
|
|
.err = NULL,
|
|
.cb = NULL,
|
|
.closed = false,
|
|
.term_sent = false,
|
|
.internal_close_cb = NULL,
|
|
.internal_exit_cb = NULL,
|
|
.detach = false
|
|
};
|
|
}
|
|
|
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
|
# include "event/process.h.generated.h"
|
|
#endif
|
|
#endif // NVIM_EVENT_PROCESS_H
|