taskrambler  0.1.9
Web server and task management solution.
queue.h
Go to the documentation of this file.
1 /**
2  * \file
3  * Holds requests ready for processing.
4  *
5  * \todo change this to a real queue.
6  *
7  * \author Georg Hopp
8  *
9  * \copyright
10  * Copyright © 2012 Georg Hopp
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef __QUEUE_H__
27 #define __QUEUE_H__
28 
29 #include <sys/types.h>
30 
31 #include "class.h"
32 #include "commons.h"
33 
34 
35 CLASS(Queue) {
36  void * msg;
37  Queue next;
38 
39  /**
40  * first and last are only available in the initial queue
41  * element (the root). This elelment does not contain any message
42  * and exists only for organizational purpose.
43  *
44  * \todo next and first always have to be the same...so get rid
45  * of first.
46  */
47  Queue first;
48  Queue last;
49  size_t nmsg;
50 };
51 
52 void queuePut(Queue, void *);
53 void * queueGet(Queue);
54 
55 #define queueEmpty(this) (0 >= (this)->nmsg)
56 
57 #endif // __QUEUE_H__
58 
59 // vim: set ts=4 sw=4:
void * queueGet(Queue)
Definition: queue/get.c:27
void queuePut(Queue, void *)
Definition: queue/put.c:27
CLASS(Queue)
Definition: queue.h:35