improve ordq

This commit is contained in:
Rongsong Shen 2025-12-22 11:58:04 +08:00
parent abea3375ca
commit c12fcf6905
4 changed files with 70 additions and 35 deletions

View file

@ -2,6 +2,7 @@
#define _ORDQ_H_ 1
#include <stdarg.h>
#include <stdint.h>
#include "mylock.h"
@ -13,7 +14,7 @@ typedef struct _ordq_item {
typedef int (*ordq_cmp_fn_t)(void*, void*, void*);
typedef void (*ordq_data_killer_t)(void*);
typedef int (*ordq_skip_fn_t)(void*, void*);
typedef int (*ordq_skip_fn_t)(void*, va_list);
typedef struct {
mylock_t lock;
@ -26,8 +27,8 @@ typedef struct {
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*, void*);
extern ordq_item_t* ordq_get(ordq_t*, ordq_skip_fn_t);
extern ordq_item_t* ordq_peek(ordq_t*, ordq_skip_fn_t);
extern ordq_item_t* ordq_get(ordq_t*, ordq_skip_fn_t, ...);
extern ordq_item_t* ordq_peek(ordq_t*, ordq_skip_fn_t, ...);
extern void ordq_set_ctx(ordq_t*, void*);
#endif