You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
according to the doc , if you call queue_get on a queue with no elements, it should return > 0.
/**
* get the first element of the queue
*
* q - the queue
* e - pointer which will be set to the element
*
* returns 0 if everything worked, > 0 if no elements in queue, < 0 if error occured
*/
int8_t queue_get(queue_t *q, void **e);
It currently returns Q_ERR_NUM_ELEMENTS (-7) instead.
int8_t queue_get(queue_t *q, void **e) {
*e = NULL;
if (q == NULL)
return Q_ERR_INVALID;
if (0 != queue_lock_internal(q))
return Q_ERR_LOCK;
int8_t r = queue_get_internal(q, e, NULL, NULL, NULL);
if (0 != queue_unlock_internal(q))
return Q_ERR_LOCK;
return r;
}
queue_get calls queue_get_internal which sets this here
int8_t queue_get_internal(queue_t *q, void **e, int (*action)(pthread_cond_t *, pthread_mutex_t *),
int (*cmp)(void *, void *), void *cmpel) {
if (q == NULL) { // queue not valid
*e = NULL;
return Q_ERR_INVALID;
}
// are elements in the queue?
if (q->num_els == 0) {
if (action == NULL) {
*e = NULL;
return Q_ERR_NUM_ELEMENTS; <------------- here
} else {
The text was updated successfully, but these errors were encountered:
according to the doc , if you call queue_get on a queue with no elements, it should return > 0.
It currently returns
Q_ERR_NUM_ELEMENTS
(-7) instead.queue_get
callsqueue_get_internal
which sets this hereThe text was updated successfully, but these errors were encountered: