From 532b3ae9b5cd8609237e04db768cc1f750d8631d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 25 Aug 2022 16:58:38 +0200 Subject: 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. --- src/worker.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/worker.h (limited to 'src/worker.h') diff --git a/src/worker.h b/src/worker.h new file mode 100644 index 0000000..5231594 --- /dev/null +++ b/src/worker.h @@ -0,0 +1,24 @@ +#ifndef __WORKER_H__ +#define __WORKER_H__ + +#include + +struct settings { + char *host; + char *port; +}; + +struct worker { + int fd; + + pthread_mutex_t task_mtx; + pthread_t task; + int task_active; +}; + +int worker_create(struct worker *, const struct settings *); +void worker_destroy(struct worker *); + +int worker_main(struct worker *, int argc, char *argv[]); + +#endif -- cgit v1.2.3