X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=src%2Fdictionary.c;h=512b4bbe6c182bf92d3161c488d3e1b89c5b9d28;hb=111fe53e19aa54e8a5fad4cce795c0783cc9257c;hp=fb9efeedb564258b24c16e5b7f0774fdc278fc23;hpb=d4c83d0cba04990c34d808641dc926b22181f82e;p=netdata.git diff --git a/src/dictionary.c b/src/dictionary.c index fb9efeed..512b4bbe 100644 --- a/src/dictionary.c +++ b/src/dictionary.c @@ -31,21 +31,21 @@ static inline void NETDATA_DICTIONARY_STATS_ENTRIES_MINUS1(DICTIONARY *dict) { static inline void dictionary_read_lock(DICTIONARY *dict) { if(likely(dict->rwlock)) { // debug(D_DICTIONARY, "Dictionary READ lock"); - pthread_rwlock_rdlock(dict->rwlock); + netdata_rwlock_rdlock(dict->rwlock); } } static inline void dictionary_write_lock(DICTIONARY *dict) { if(likely(dict->rwlock)) { // debug(D_DICTIONARY, "Dictionary WRITE lock"); - pthread_rwlock_wrlock(dict->rwlock); + netdata_rwlock_wrlock(dict->rwlock); } } static inline void dictionary_unlock(DICTIONARY *dict) { if(likely(dict->rwlock)) { // debug(D_DICTIONARY, "Dictionary UNLOCK lock"); - pthread_rwlock_unlock(dict->rwlock); + netdata_rwlock_unlock(dict->rwlock); } } @@ -135,8 +135,8 @@ DICTIONARY *dictionary_create(uint8_t flags) { dict->stats = callocz(1, sizeof(struct dictionary_stats)); if(!(flags & DICTIONARY_FLAG_SINGLE_THREADED)) { - dict->rwlock = callocz(1, sizeof(pthread_rwlock_t)); - pthread_rwlock_init(dict->rwlock, NULL); + dict->rwlock = callocz(1, sizeof(netdata_rwlock_t)); + netdata_rwlock_init(dict->rwlock); } avl_init(&dict->values_index, name_value_compare); @@ -158,8 +158,10 @@ void dictionary_destroy(DICTIONARY *dict) { if(dict->stats) freez(dict->stats); - if(dict->rwlock) + if(dict->rwlock) { + netdata_rwlock_destroy(dict->rwlock); freez(dict->rwlock); + } freez(dict); }