taskrambler  0.1.9
Web server and task management solution.
queue.h File Reference
#include <sys/types.h>
#include "class.h"
#include "commons.h"
+ Include dependency graph for queue.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define queueEmpty(this)   (0 >= (this)->nmsg)
 

Functions

 CLASS (Queue)
 
void queuePut (Queue, void *)
 
void * queueGet (Queue)
 

Detailed Description

Holds requests ready for processing.

Todo:
change this to a real queue.
Author
Georg Hopp

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file queue.h.

Macro Definition Documentation

#define queueEmpty (   this)    (0 >= (this)->nmsg)

Definition at line 55 of file queue.h.

Referenced by httpWorkerProcess(), and httpWriterWrite().

Function Documentation

CLASS ( Queue  )

first and last are only available in the initial queue element (the root). This elelment does not contain any message and exists only for organizational purpose.

Todo:
next and first always have to be the same...so get rid of first.

Definition at line 35 of file queue.h.

35  {
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 };
void* queueGet ( Queue  )

Definition at line 27 of file queue/get.c.

Referenced by httpWorkerAddComputedHeader(), httpWorkerProcess(), and httpWriterWrite().

28 {
29  Queue first;
30  void * msg;
31 
32  if (NULL == this->first) {
33  return NULL;
34  }
35 
36  msg = this->first->msg;
37  first = this->first->next;
38 
39  if (this->first == this->last) {
40  this->last = NULL;
41  }
42  delete(this->first);
43 
44  this->next = first;
45  this->first = first;
46  this->nmsg--;
47 
48  return msg;
49 }

+ Here is the caller graph for this function:

void queuePut ( Queue  ,
void *   
)

Definition at line 27 of file queue/put.c.

Referenced by applicationAdapterHttpUpdate(), httpParserParse(), and httpWorkerProcess().

28 {
29  Queue node = (this->last)? this->last : this;
30 
31  node->next = new(Queue);
32  this->last = node->next;
33 
34  if (node == this) {
35  this->first = node->next;
36  }
37 
38  node->next->msg = msg;
39  this->nmsg++;
40 }

+ Here is the caller graph for this function: