12 /* do not read or write any members of this structure outside queue.c!
14 struct fqueue_record
*first
;
15 struct fqueue_record
*last
;
16 unsigned int lock_level
;
19 unsigned is_dirty
: 1;
22 #define FQUEUE_INIT { NULL, NULL, 0 }
26 typedef int (*check_fqueue_object_t
)(void *object
, void *operate_args
);
27 typedef void (*operate_fqueue_object_t
)(void *object
, void *operate_args
);
28 typedef int (*cmp_objects_t
)(void *object1
, void *object2
, void *args
);
29 typedef void (*destroy_fqueue_object_t
)(void *object
);
32 * Basic queue management
35 void fqueue_init(fqueue
*fq
);
36 unsigned int fqueue_get_length(fqueue
*fq
);
37 #define FQUEUE_IS_EMPTY(fq) ((fq)->first == NULL)
43 void fqueue_add_at_front(fqueue
*fq
, void *object
);
44 void fqueue_add_at_end(fqueue
*fq
, void *object
);
45 void fqueue_add_inside(
46 fqueue
*fq
, void *object
, cmp_objects_t cmp_objects
, void *cmp_args
);
52 int fqueue_get_first(fqueue
*fq
, void **ret_object
);
55 * Operate on queue objects and possibly remove them from the queue
58 void fqueue_remove_or_operate_from_front(
60 check_fqueue_object_t check_func
,
61 operate_fqueue_object_t operate_func
,
62 destroy_fqueue_object_t destroy_func
,
64 void fqueue_remove_or_operate_from_end(
66 check_fqueue_object_t check_func
,
67 operate_fqueue_object_t operate_func
,
68 destroy_fqueue_object_t destroy_func
,
70 void fqueue_remove_or_operate_all(
72 check_fqueue_object_t check_func
,
73 operate_fqueue_object_t operate_func
,
74 destroy_fqueue_object_t destroy_func
,