4
typedef struct HWSchedT *HWSched;
9
HW_SCHED_MODE_PREALLOCATED = 0,
10
HW_SCHED_MODE_SEQUENTIAL
12
typedef enum HWSchedModeT HWSchedMode;
15
#define HW_MAX_THREADS 128
17
#ifndef HW_HIDE_DETAILS
24
HWThread thread[HW_MAX_THREADS];
27
pthread_cond_t job_cond, compl_cond;
28
pthread_mutex_t job_cond_mutex, compl_cond_mutex, data_mutex;
37
typedef struct HWSchedT HWSchedS;
38
#endif /* HW_HIDE_DETAILS */
40
HWSched hw_sched_create();
41
void hw_sched_destroy(HWSched ctx);
42
int hw_sched_set_sequential_mode(HWSched ctx, int *n_blocks, int *cur_block);
43
int hw_sched_get_chunk(HWSched ctx, int thread_id);
44
int hw_sched_schedule_task(HWSched ctx, void *appctx, int entry);
45
int hw_sched_wait_task(HWSched ctx);
47
#define hw_sched_lock(ctx, type) pthread_mutex_lock(&ctx->type##_mutex)
48
#define hw_sched_unlock(ctx, type) pthread_mutex_unlock(&ctx->type##_mutex)
49
#define hw_sched_broadcast(ctx, type) pthread_cond_broadcast(&ctx->type##_cond)
50
#define hw_sched_signal(ctx, type) pthread_cond_signal(&ctx->type##_cond)
51
#define hw_sched_wait(ctx, type) pthread_cond_wait(&ctx->type##_cond, &ctx->type##_cond_mutex)
53
#endif /* _HW_SCHED_H */