aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-06-12 21:18:28 +0530
committersinanmohd <sinan@sinanmohd.com>2024-06-12 21:22:53 +0530
commitadd3c9f6d8464c29d729606fbf0e3311ec759e20 (patch)
tree96347c3e36f085651c6009d7d7457c1a9e3a40cc /include
parent4c7093f68e8c576e1e10dbb31597c810691fd6e2 (diff)
src/queue: init
Diffstat (limited to 'include')
-rw-r--r--include/jobs.h5
-rw-r--r--include/queue.h19
2 files changed, 23 insertions, 1 deletions
diff --git a/include/jobs.h b/include/jobs.h
index 41bfa57..be95c57 100644
--- a/include/jobs.h
+++ b/include/jobs.h
@@ -8,15 +8,18 @@ struct output {
};
LIST_HEAD(job_dlist, job);
+CIRCLEQ_HEAD(job_clist, job);
struct job {
char *name, *drv_path;
struct output_dlist outputs;
struct job_dlist deps;
+ /* TODO: replace dlist with clist jobs.c */
LIST_ENTRY(job) dlist;
+ CIRCLEQ_ENTRY(job) clist;
};
int jobs_init(FILE **stream);
int job_new(struct job **j, char *name, char *drv_path);
void job_free(struct job *j);
-int jobs_read(FILE *stream, struct job *jobs);
+int job_read(FILE *stream, struct job **jobs);
diff --git a/include/queue.h b/include/queue.h
new file mode 100644
index 0000000..ca11614
--- /dev/null
+++ b/include/queue.h
@@ -0,0 +1,19 @@
+#include <pthread.h>
+#include <sys/queue.h>
+
+#include "jobs.h"
+
+struct queue {
+ struct job_clist jobs;
+ pthread_mutex_t mutex;
+};
+
+struct queue_thread {
+ pthread_t tid;
+ struct queue *queue;
+ FILE *stream;
+};
+
+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);