myxce/src/scheduler/include/scheduler.h

40 lines
926 B
C

#if !defined(_SCHEDULER_H_)
#define _SCHEDULER_H_ 1
#include <pthread.h>
#include "client.h"
#include "mylock.h"
#include "xce/types.h"
#include "xlist.h"
typedef enum {
XCE_DECISION_NONE = 0,
XCE_DECISION_DISPATCH,
XCE_DECISION_PEND
} xce_decision_op_t;
typedef struct {
xce_decision_op_t op;
union {
xce_job_alloc_t* alloc;
} u;
} xce_decision_t;
typedef struct {
xcecli_ctx_t apictx;
pthread_t jobpicker;
pthread_t allocator;
cbuf_t wbuf; /* action to trigger scheduling */
cbuf_t jbuf; /* job picked for allocation */
cbuf_t decisions; /* scheduler decisions */
} xce_scheduler_t;
extern int sched_init(xce_scheduler_t*, xce_client_config_t*,
xce_request_handler_t);
extern void sched_fini(xce_scheduler_t*);
extern int sched_update(xce_scheduler_t*);
extern void sched_go(xce_scheduler_t*);
#endif