source: doc/theses/mike_brooks_MMath/programs/lst-issues-intrusive.run.c

Last change on this file was 1379c96e, checked in by Peter A. Buhr <pabuhr@…>, 11 days ago

formatting changes to programs

  • Property mode set to 100644
File size: 408 bytes
Line 
1#include <sys/queue.h>
2#include <stdio.h>
3
4
5
6int main() {
7
8
9
10
11
12
13
14
15
16
17
18
19
20// C
21
22struct req {
23        int pri, rqr;
24        LIST_ENTRY(req) d;
25};
26LIST_HEAD(reql, req);
27
28struct reql reqs;
29LIST_INIT(&reqs);
30
31struct req r1 = {1, 42}, r2 = {2, 42};
32
33LIST_INSERT_HEAD(&reqs, &r2, d);
34LIST_INSERT_HEAD(&reqs, &r1, d);
35
36
37
38
39
40
41
42
43
44
45
46struct req *cur;
47LIST_FOREACH(cur, &reqs, d)
48        printf("{%d %d} ", cur->pri, cur->rqr);
49printf("\n");
50
51}
Note: See TracBrowser for help on using the repository browser.