 |
QUEUE |
Type (Structure constructor) |
A structure describing a queue with a buffer.
QUEUE(n) is a structure which describes a queue with an n-byte long buffer. Strictly
speaking, QUEUE(n) is not a type but a macro,
although it works exactly as a type, so you can treat it as a type. It is useful for
definining a queue without dynamic allocation (i.e. without calling
malloc), like in the following example:
QUEUE(100) q;
OSqclear (&q);
q.Size = 50;
OSenqueue (some_data, &q);
Note that QUEUE(n) works exactly like a type, so it can be used anywhere where a type
name is expected, for example in pointer declarations, and even as the argument of
sizeof etc. This is illustrated in the following example:
QUEUE(100) *qptr = malloc (sizeof (QUEUE(100)));
OSqclear (qptr);
qptr->Size = 50;
OSenqueue (some_data, qptr);
See also: DEF_QUEUE