diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-07-03 19:16:21 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-07-03 22:28:45 +0530 |
commit | 5602a17e4c916c1fe90a0025fbdceb0621e2e9ba (patch) | |
tree | e454fdaba66a9a0d34ca2ecbde5a978ecb9f29b5 /include | |
parent | 4a00927f139c545288c1ae2d197d4fdc8fa36051 (diff) |
solver_greedy: init
Diffstat (limited to 'include')
-rw-r--r-- | include/evanix.h | 3 | ||||
-rw-r--r-- | include/jobs.h | 1 | ||||
-rw-r--r-- | include/queue.h | 11 | ||||
-rw-r--r-- | include/solver_greedy.h | 3 |
4 files changed, 12 insertions, 6 deletions
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 <stdbool.h> +#include <stdint.h> #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 <pthread.h> -#include <stdint.h> #include <search.h> #include <semaphore.h> +#include <stdint.h> #include <sys/queue.h> #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); |