diff options
Diffstat (limited to 'src/line_protocol_output.cpp')
| -rw-r--r-- | src/line_protocol_output.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/line_protocol_output.cpp b/src/line_protocol_output.cpp index 9110205..3c687ed 100644 --- a/src/line_protocol_output.cpp +++ b/src/line_protocol_output.cpp @@ -481,7 +481,9 @@ int line_protocol_dynamic_metric_output(struct fieldstat_dynamic_instance *insta for(int i = 0; i < instance->n_thread; i++) { std::vector<std::string> line_buf_to_send; - pthread_spin_lock(instance->uthash_locks + i); + struct uthash_spinlock *uthash_lock = instance->uthash_locks + i; + + pthread_spin_lock(&(uthash_lock->lock)); head = &instance->n_thread_dynamic_metric[i]; HASH_ITER(hh, *head, dyn_metric, tmp_dyn_metric) { @@ -502,7 +504,7 @@ int line_protocol_dynamic_metric_output(struct fieldstat_dynamic_instance *insta /* copy the line_buf as str to vector line_buf_to_send */ line_buf_to_send.push_back(std::string(line_buf)); } - pthread_spin_unlock(instance->uthash_locks + i); + pthread_spin_unlock(&(uthash_lock->lock)); for (std::vector<std::string>::iterator it = line_buf_to_send.begin(); it != line_buf_to_send.end(); ++it) { |
