aboutsummaryrefslogtreecommitdiff
path: root/task_queue.h
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-09-13 20:53:56 +0800
committerMistivia <i@mistivia.com>2025-09-13 20:53:56 +0800
commita4daf467f871b0e77f07f1071b47b960da7bfba9 (patch)
tree43b8847b395a90f5aadb57593c0d84e2c13cca7c /task_queue.h
parentf3eeea1d7092f3ca98836035bf75b941d14c2067 (diff)
add s3 client
Diffstat (limited to 'task_queue.h')
-rw-r--r--task_queue.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/task_queue.h b/task_queue.h
new file mode 100644
index 0000000..2843fb9
--- /dev/null
+++ b/task_queue.h
@@ -0,0 +1,28 @@
+#ifndef TASK_QUEUE_H_
+#define TASK_QUEUE_H_
+
+#include <pthread.h>
+
+typedef void (*TaskFn)(void *arg);
+
+typedef struct {
+ TaskFn *tasks;
+ void **args;
+ int capacity;
+ int front;
+ int end;
+ int size;
+ pthread_mutex_t lock;
+ pthread_cond_t not_full;
+ pthread_cond_t not_empty;
+} TaskQueue;
+
+void TaskQueue_init(TaskQueue *self, int capacity);
+
+void TaskQueue_destroy(TaskQueue *self);
+
+void TaskQueue_push(TaskQueue *self, TaskFn task, void *arg);
+
+void TaskQueue_pop(TaskQueue *self, TaskFn *task, void **arg);
+
+#endif