summaryrefslogtreecommitdiff
path: root/broccoli/src
diff options
context:
space:
mode:
Diffstat (limited to 'broccoli/src')
-rw-r--r--broccoli/src/fifoqueue.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/broccoli/src/fifoqueue.c b/broccoli/src/fifoqueue.c
index 9b972e7..87e0332 100644
--- a/broccoli/src/fifoqueue.c
+++ b/broccoli/src/fifoqueue.c
@@ -48,13 +48,13 @@ is_empty(Fifo_q * q)
int
add_to_queue(Fifo_q * q, Sensor_t * sensor)
{
+ if (q == NULL)
+ return -1;
pthread_mutex_lock(&lock);
/* TODO delete first one if full */
- if(q == NULL){
- return -1;
- }
- else if(is_full(q)){
+ if(is_full(q)){
+ pthread_mutex_unlock(&lock);
return -1;
}
Queue_t * new_elem = (Queue_t *) malloc(sizeof(Queue_t));