Project

General

Profile

Revision 336

Updated wireless to use a circular buffer instead of a queue using malloc. Tested on both the computer and robots with a token ring, and was successful.

View differences:

queue.h
35 35
#ifndef WIRELESS_QUEUE_H
36 36
#define WIRELESS_QUEUE_H
37 37

  
38
#ifndef ROBOT
39
#include <pthread.h>
40
#endif
41

  
38 42
struct node_def;
39 43

  
40 44
/**
......
64 68
	 * The number of elements in the queue.
65 69
	 **/
66 70
	int size;
71
	
72
#ifndef ROBOT
73
	pthread_mutex_t lock;
74
#endif
67 75
} Queue;
68 76

  
69 77
/** @brief Create a new queue **/
......
71 79
/** @brief Destroy a queue **/
72 80
void queue_destroy(Queue* q);
73 81
/** @brief Add an element to a queue **/
74
void queue_add(Queue* q, void* item);
82
int queue_add(Queue* q, void* item);
75 83
/** @brief Remove an element from a queue **/
76 84
void* queue_remove(Queue* q);
77 85
/** @brief Remove all instances of a given element from a queue **/
......
85 93

  
86 94

  
87 95
#endif
88

  

Also available in: Unified diff