Skip to content

Commit

Permalink
optimize locking a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
tony2001 committed Jun 25, 2015
1 parent 21b7db3 commit 156ee72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ void clear_record_timers_func(void *job_data) /* {{{ */
timer->value.tv_usec = 0;
timer->hit_count = 0;
}
record->timers_cnt = 0;
/* record->timers_cnt = 0; can't do that under read lock */
}
}
/* }}} */
Expand Down Expand Up @@ -484,6 +484,10 @@ void *pinba_stats_main(void *arg) /* {{{ */
pinba_request_pool_delete_old(from, &deleted_timer_cnt, &rtags_cnt);

new_request_id = request_pool->out;
pthread_rwlock_unlock(&D->collector_lock);

/* relock for reading */
pthread_rwlock_rdlock(&D->collector_lock);

{
unsigned int i, accounted, job_size, num;
Expand Down

0 comments on commit 156ee72

Please sign in to comment.