Files
neovim/src/nvim/event/process.h
Justin M. Keyes 6186df3562 event/multiqueue.c: Rename "queue" to "multiqueue".
`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).
2016-10-02 00:24:49 +02:00

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