00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CUFLOW_SCHED_TYPES_H
00019 #define CUFLOW_SCHED_TYPES_H
00020
00021 #include <cuflow/fwd.h>
00022 #include <cu/clos.h>
00023 #include <atomic_ops.h>
00024
00025 CU_BEGIN_DECLARATIONS
00026
00027
00028
00029
00030
00031 #define CUFLOW_EXEQ_SIZE 8
00032 #define CUFLOW_EXEQ_MASK (CUFLOW_EXEQ_SIZE - 1)
00033 #define CUFLOW_PROFILE_SCHED 0
00034 #define CUFLOW_CALLS_BETWEEN_SCHED 1
00035
00036 typedef struct cuflow_exeq *cuflow_exeq_t;
00037 typedef struct cuflow_exeq_entry *cuflow_exeq_entry_t;
00038
00039
00040 typedef enum {
00041 cuflow_exeqpri_begin = 0,
00042 cuflow_exeqpri_normal = 0,
00043 cuflow_exeqpri_background = 1,
00044 cuflow_exeqpri_end
00045 } cuflow_exeqpri_t;
00046
00047 #define cuflow_exeqpri_succ(pri) ((cuflow_exeqpri_t)((pri) + 1))
00048
00049
00050 CU_SINLINE cu_bool_t
00051 cuflow_exeqpri_prioreq(cuflow_exeqpri_t pri0, cuflow_exeqpri_t pri1)
00052 { return pri0 <= pri1; }
00053
00054
00055 CU_SINLINE cu_bool_t
00056 cuflow_exeqpri_prior(cuflow_exeqpri_t pri0, cuflow_exeqpri_t pri1)
00057 { return pri0 < pri1; }
00058
00059 struct cuflow_exeq_entry
00060 {
00061 cu_clop0(fn, void);
00062 AO_t *cdisj;
00063 };
00064
00065
00066
00067
00068
00069 struct cuflow_exeq
00070 {
00071 pthread_mutex_t pickup_mutex;
00072 cuflow_exeqpri_t priority;
00073 struct cuflow_exeq_entry call_arr[CUFLOW_EXEQ_SIZE];
00074 AO_t head, tail;
00075 #if CUFLOW_CALLS_BETWEEN_SCHED > 1
00076 int calls_till_sched;
00077 #endif
00078 };
00079
00080
00081 CU_END_DECLARATIONS
00082
00083 #endif