cugblbs / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

pthread_cond_signal(&cq->cond) is needless. #293

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
static void cq_push(CQ *cq, CQ_ITEM *item) {
    item->next = NULL;

    pthread_mutex_lock(&cq->lock);
    if (NULL == cq->tail)
        cq->head = item;
    else
        cq->tail->next = item;
    cq->tail = item;
    pthread_cond_signal(&cq->cond);
    pthread_mutex_unlock(&cq->lock);
}

pthread_cond_signal(&cq->cond) should be removed because there is no 
pthread_cond_wait(&cq->cond, &cq->lock) in version 1.4.15.

Original issue reported on code.google.com by xiexiang...@gmail.com on 16 Oct 2012 at 2:54

GoogleCodeExporter commented 9 years ago
https://github.com/memcached/memcached/pull/27

Original comment by trond.no...@gmail.com on 17 Oct 2012 at 11:02

GoogleCodeExporter commented 9 years ago
Is there a need for the condition variable then?

Original comment by peter.a....@gmail.com on 7 Nov 2012 at 11:05

GoogleCodeExporter commented 9 years ago
I guess not.

It was in a cq_pop function that was added with the initial multithreaded 
branch in 2007... that code was never used and later removed. This is vestigial 
so far as I can tell.

Pulled the pull requests..

Original comment by dorma...@rydia.net on 9 Dec 2013 at 2:21