From f881fe7d158287b25381a90760fd441e7dff7a65 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 18 Jul 2024 09:43:42 +0530 Subject: queue: switch to uthash --- include/htab.h | 18 ------------------ include/jobs.h | 2 ++ include/queue.h | 5 ++--- 3 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 include/htab.h (limited to 'include') diff --git a/include/htab.h b/include/htab.h deleted file mode 100644 index 7ea1730..0000000 --- a/include/htab.h +++ /dev/null @@ -1,18 +0,0 @@ -#include - -#ifndef HTAB_H - -struct htab { - struct hsearch_data *table; - char **keys; - size_t keys_size, key_filled; -}; - -void htab_free(struct htab *htab); -int htab_init(size_t nel, struct htab **htab); -int htab_delete(struct htab *htab, const char *key); -int htab_enter(struct htab *htab, const char *key, void *data); -int htab_search(struct htab *htab, char *key, ENTRY **ep); - -#define HTAB_H -#endif diff --git a/include/jobs.h b/include/jobs.h index ecf9d96..cbcce74 100644 --- a/include/jobs.h +++ b/include/jobs.h @@ -2,6 +2,7 @@ #include #include #include +#include #ifndef JOBS_H @@ -21,6 +22,7 @@ struct job { struct job **deps; size_t parents_size, parents_filled; struct job **parents; + UT_hash_handle hh; /* queue */ CIRCLEQ_ENTRY(job) clist; diff --git a/include/queue.h b/include/queue.h index cfc67ef..ca318cf 100644 --- a/include/queue.h +++ b/include/queue.h @@ -4,7 +4,6 @@ #include #include -#include "htab.h" #include "jobs.h" #include "solver_util.h" @@ -20,7 +19,7 @@ struct queue { sem_t sem; queue_state_t state; pthread_mutex_t mutex; - struct htab *htab; + struct job *htab; /* solver */ struct jobid *jobid; @@ -36,7 +35,7 @@ struct queue_thread { 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_pop(struct queue *queue, struct job **job); int queue_isempty(struct job_clist *jobs); #define QUEUE_H -- cgit v1.2.3