Update key files in preparation for 2.5.31.
[fvwm.git] / libs / queue.h
blob068e6a30480abbf619aa0a60032b5bb8941c9e2d
1 /* -*-c-*- */
3 #ifndef QUEUE_H
4 #define QUEUE_H
6 /*
7 * type definitions
8 */
10 typedef struct
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;
17 struct
19 unsigned is_dirty : 1;
20 } flags;
21 } fqueue;
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)
40 * Add record to queue
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);
49 * Fetch queue objects
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(
59 fqueue *fq,
60 check_fqueue_object_t check_func,
61 operate_fqueue_object_t operate_func,
62 destroy_fqueue_object_t destroy_func,
63 void *operate_args);
64 void fqueue_remove_or_operate_from_end(
65 fqueue *fq,
66 check_fqueue_object_t check_func,
67 operate_fqueue_object_t operate_func,
68 destroy_fqueue_object_t destroy_func,
69 void *operate_args);
70 void fqueue_remove_or_operate_all(
71 fqueue *fq,
72 check_fqueue_object_t check_func,
73 operate_fqueue_object_t operate_func,
74 destroy_fqueue_object_t destroy_func,
75 void *operate_args);
77 #endif /* QUEUE_H */