30 lines
444 B
C
30 lines
444 B
C
#ifndef CJOB_CJOB_H_
|
|
#define CJOB_CJOB_H_
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include "spinlock/spinlock.h"
|
|
|
|
typedef void (*CJobFn)(void *arg);
|
|
|
|
typedef struct CJob {
|
|
struct CJob *next;
|
|
CJobFn fn;
|
|
void *arg;
|
|
int32_t id;
|
|
} CJob;
|
|
|
|
typedef struct {
|
|
SpinLock spinlock;
|
|
CJob *cjobs;
|
|
} CJobs;
|
|
|
|
extern CJobs CJOBS;
|
|
|
|
void cjob_init(void);
|
|
|
|
int32_t cjob_register(CJobFn fn, void *arg);
|
|
void cjob_runjobs(void);
|
|
|
|
#endif // CJOB_CJOB_H_
|