Skip to content

Commit

Permalink
Improved derefcnting
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhill committed Mar 8, 2013
1 parent f808f27 commit 2326c71
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions rdkafka.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,9 @@ static void rd_kafka_destroy0 (rd_kafka_t *rk) {


void rd_kafka_destroy (rd_kafka_t *rk) {
(void)rd_atomic_sub(&rk->rk_refcnt, 1);
rk->rk_terminate = 1;

if (rk->rk_refcnt == 0)
if (rd_atomic_sub(&rk->rk_refcnt, 1) == 0)
rd_kafka_destroy0(rk);
}

Expand Down

0 comments on commit 2326c71

Please sign in to comment.