diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-25 16:58:38 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-26 04:05:02 +0200 |
commit | 532b3ae9b5cd8609237e04db768cc1f750d8631d (patch) | |
tree | f65253a6ce9970d1d93e6bb6c65758d6fa98373a /src/worker_queue.h | |
parent | cmake: ignore unused parameters for now (diff) | |
download | cimple-532b3ae9b5cd8609237e04db768cc1f750d8631d.tar.gz cimple-532b3ae9b5cd8609237e04db768cc1f750d8631d.zip |
add some more code
This adds a basic "worker" program.
You can now do something like
./server &
./worker &
./client ci_run URL REV
and the server should pass a message to worker, after which it should
clone the repository at URL, checkout REV, and try to run the CI script.
It's extremely unfinished: I need to sort out the graceful shutdown, how
the server manages workers, etc.
Diffstat (limited to 'src/worker_queue.h')
-rw-r--r-- | src/worker_queue.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/worker_queue.h b/src/worker_queue.h new file mode 100644 index 0000000..d5e0bb2 --- /dev/null +++ b/src/worker_queue.h @@ -0,0 +1,26 @@ +#ifndef __WORKER_QUEUE_H__ +#define __WORKER_QUEUE_H__ + +#include <sys/queue.h> + +struct worker_queue_entry { + int fd; + STAILQ_ENTRY(worker_queue_entry) entries; +}; + +int worker_queue_entry_create(struct worker_queue_entry **, int fd); +void worker_queue_entry_destroy(struct worker_queue_entry *); + +STAILQ_HEAD(worker_queue, worker_queue_entry); + +void worker_queue_create(struct worker_queue *); +void worker_queue_destroy(struct worker_queue *); + +int worker_queue_is_empty(const struct worker_queue *); + +void worker_queue_push(struct worker_queue *, struct worker_queue_entry *); +void worker_queue_push_head(struct worker_queue *, struct worker_queue_entry *); + +struct worker_queue_entry *worker_queue_pop(struct worker_queue *); + +#endif |