Skeleton Event Loop Ready

This commit is contained in:
2024-06-03 16:03:05 +05:30
parent c4c3b013c0
commit 6114206eb7
6 changed files with 289 additions and 4 deletions

View File

@@ -1,11 +1,13 @@
#ifndef __EV_LOOP__
#define __EV_LOOP__
#include <pthread.h>
typedef struct task_ task_t;
typedef struct event_loop_ event_loop_t;
typedef EL_RES_T(*event_cbk)(void*);
typedef void (*event_cbk)(void*);
struct task_ {
@@ -23,7 +25,7 @@ typedef enum {
struct event_loop_ {
/* head to the start of the task array */
struct task_* task_array_head[TASK_PRIORITY_MAX];
struct task_* task_array_head;
/* Mutex to enforce Mutual exclusion enqueue/Deque
* Operation in task array. Also used to update event loop
* attributes in mutual exclusive way
@@ -40,4 +42,13 @@ struct event_loop_ {
struct task_* current_task;
};
void
event_loop_init(event_loop_t* el);
void
event_loop_run(event_loop_t* el);
task_t*
task_create_new_job(event_loop_t* el, event_cbk cbk, void* arg);
#endif