merge job rusage and pending reason support

This commit is contained in:
Rongsong Shen 2025-12-16 14:36:28 +08:00
parent 30824ae5ea
commit cb0c7fe9e7
82 changed files with 4280 additions and 2561 deletions

35
src/include/ordq.h Normal file
View file

@ -0,0 +1,35 @@
#if !defined(_ORDQ_H_)
#define _ORDQ_H_ 1
#include <stdint.h>
#include "mylock.h"
typedef void* ordkey_t;
typedef struct _ordq_item {
struct _ordq_item* next;
ordkey_t key;
void* data;
} ordq_item_t;
typedef int (*ordq_cmp_fn_t)(ordkey_t, ordkey_t);
typedef void (*ordq_data_killer_t)(void*);
typedef struct {
mylock_t lock;
ordq_item_t* head;
ordq_data_killer_t killer;
ordq_cmp_fn_t cmp;
} ordq_t;
#define mk_ordkey(k) (ordkey_t)((long)(k))
extern int ordq_init(ordq_t*, ordq_data_killer_t, ordq_cmp_fn_t);
extern void ordq_fini(ordq_t* q);
extern int ordq_put(ordq_t*, ordkey_t, void*);
extern ordq_item_t* ordq_get(ordq_t*);
extern ordq_item_t* ordq_peek(ordq_t*);
#endif