From 5602a17e4c916c1fe90a0025fbdceb0621e2e9ba Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Wed, 3 Jul 2024 19:16:21 +0530 Subject: solver_greedy: init --- include/evanix.h | 3 ++- include/jobs.h | 1 - include/queue.h | 11 +++++++---- include/solver_greedy.h | 3 +++ 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 include/solver_greedy.h (limited to 'include') diff --git a/include/evanix.h b/include/evanix.h index 32f6ed6..48fe110 100644 --- a/include/evanix.h +++ b/include/evanix.h @@ -1,4 +1,5 @@ #include +#include #ifndef EVANIX_H @@ -8,7 +9,7 @@ struct evanix_opts_t { bool ispipelined; bool close_stderr_exec; char *system; - int max_build; + uint32_t max_build; }; extern struct evanix_opts_t evanix_opts; diff --git a/include/jobs.h b/include/jobs.h index 41d8adf..ccdff65 100644 --- a/include/jobs.h +++ b/include/jobs.h @@ -27,7 +27,6 @@ struct job { /* solver */ ssize_t id; - uint64_t age; bool stale; }; CIRCLEQ_HEAD(job_clist, job); diff --git a/include/queue.h b/include/queue.h index c81f062..cfc67ef 100644 --- a/include/queue.h +++ b/include/queue.h @@ -1,7 +1,7 @@ #include -#include #include #include +#include #include #include "htab.h" @@ -17,12 +17,14 @@ typedef enum { struct queue { struct job_clist jobs; - struct htab *htab; - struct jobid *jobid; sem_t sem; queue_state_t state; pthread_mutex_t mutex; - uint64_t age; + struct htab *htab; + + /* solver */ + struct jobid *jobid; + int32_t resources; }; struct queue_thread { @@ -35,6 +37,7 @@ int queue_thread_new(struct queue_thread **queue_thread, FILE *stream); void queue_thread_free(struct queue_thread *queue_thread); void *queue_thread_entry(void *queue_thread); int queue_pop(struct queue *queue, struct job **job, struct htab *htab); +int queue_isempty(struct job_clist *jobs); #define QUEUE_H #endif diff --git a/include/solver_greedy.h b/include/solver_greedy.h new file mode 100644 index 0000000..5119818 --- /dev/null +++ b/include/solver_greedy.h @@ -0,0 +1,3 @@ +#include "jobs.h" + +int solver_greedy(struct job_clist *q, int32_t *max_build, struct job **job); -- cgit v1.2.3