X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/frsh-forb.git/blobdiff_plain/b073af42922e0dca537df0ef66444b4108dd0b00..99d401eaec7477698549ab6f85cf25b5aa0e840b:/src/fwp/fwp/lib/fwp/fwp_msgq.c diff --git a/src/fwp/fwp/lib/fwp/fwp_msgq.c b/src/fwp/fwp/lib/fwp/fwp_msgq.c index 1af89bdf..443aec04 100644 --- a/src/fwp/fwp/lib/fwp/fwp_msgq.c +++ b/src/fwp/fwp/lib/fwp/fwp_msgq.c @@ -89,7 +89,7 @@ int fwp_msgq_enqueue(struct fwp_msgq *msgq, struct fwp_msgb *msgb) /* depends on queuing policy specifies in endpoint */ msgq->queue[msgq->in] = msgb; msgq->nr_pending++; - msgq->in = (++msgq->in) & (FWP_MSGQ_SIZE - 1); + msgq->in = (msgq->in + 1) & (FWP_MSGQ_SIZE - 1); sem_post(&msgq->msg_sem); /* release queue mutex */ @@ -116,7 +116,7 @@ struct fwp_msgb* fwp_msgq_dequeue(struct fwp_msgq *msgq) msgb = msgq->queue[msgq->out]; msgq->nr_pending--; - msgq->out = (++msgq->out) & (FWP_MSGQ_SIZE - 1); + msgq->out = (msgq->out + 1) & (FWP_MSGQ_SIZE - 1); /* release queue mutex */ pthread_mutex_unlock(&msgq->lock); @@ -157,7 +157,7 @@ void fwp_msgq_dequeue_all(struct fwp_msgq *msgq) while (msgq->in != msgq->out){ msgb = msgq->queue[msgq->out]; msgq->nr_pending--; - msgq->out = (++msgq->out) & (FWP_MSGQ_SIZE - 1); + msgq->out = (msgq->out + 1) & (FWP_MSGQ_SIZE - 1); fwp_msgb_free(msgb); }