Changeset View
Changeset View
Standalone View
Standalone View
head/sys/sys/_task.h
Show All 33 Lines | |||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
/* | /* | ||||
* Each task includes a function which is called from | * Each task includes a function which is called from | ||||
* taskqueue_run(). The first argument is taken from the 'ta_context' | * taskqueue_run(). The first argument is taken from the 'ta_context' | ||||
* field of struct task and the second argument is a count of how many | * field of struct task and the second argument is a count of how many | ||||
* times the task was enqueued before the call to taskqueue_run(). | * times the task was enqueued before the call to taskqueue_run(). | ||||
* | * | ||||
* List of locks | * List of locks | ||||
* (c) const after init | * (c) const after init | ||||
* (q) taskqueue lock | * (q) taskqueue lock | ||||
*/ | */ | ||||
typedef void task_fn_t(void *context, int pending); | typedef void task_fn_t(void *context, int pending); | ||||
typedef void gtask_fn_t(void *context); | |||||
struct task { | struct task { | ||||
STAILQ_ENTRY(task) ta_link; /* (q) link for queue */ | STAILQ_ENTRY(task) ta_link; /* (q) link for queue */ | ||||
uint16_t ta_pending; /* (q) count times queued */ | uint16_t ta_pending; /* (q) count times queued */ | ||||
u_short ta_priority; /* (c) Priority */ | u_short ta_priority; /* (c) Priority */ | ||||
task_fn_t *ta_func; /* (c) task handler */ | task_fn_t *ta_func; /* (c) task handler */ | ||||
void *ta_context; /* (c) argument for handler */ | void *ta_context; /* (c) argument for handler */ | ||||
}; | }; | ||||
#ifdef _KERNEL | |||||
typedef void gtask_fn_t(void *context); | |||||
struct gtask { | struct gtask { | ||||
STAILQ_ENTRY(gtask) ta_link; /* (q) link for queue */ | STAILQ_ENTRY(gtask) ta_link; /* (q) link for queue */ | ||||
uint16_t ta_flags; /* (q) state flags */ | uint16_t ta_flags; /* (q) state flags */ | ||||
u_short ta_priority; /* (c) Priority */ | u_short ta_priority; /* (c) Priority */ | ||||
gtask_fn_t *ta_func; /* (c) task handler */ | gtask_fn_t *ta_func; /* (c) task handler */ | ||||
void *ta_context; /* (c) argument for handler */ | void *ta_context; /* (c) argument for handler */ | ||||
}; | }; | ||||
struct grouptask { | #endif /* _KERNEL */ | ||||
struct gtask gt_task; | |||||
void *gt_taskqueue; | |||||
LIST_ENTRY(grouptask) gt_list; | |||||
void *gt_uniq; | |||||
#define GROUPTASK_NAMELEN 32 | |||||
char gt_name[GROUPTASK_NAMELEN]; | |||||
int16_t gt_irq; | |||||
int16_t gt_cpu; | |||||
}; | |||||
#endif /* !_SYS__TASK_H_ */ | #endif /* !_SYS__TASK_H_ */ |