static void add_for_event(zk_hashtable *ht, char *path, watcher_object_list_t **list) { watcher_object_list_t* wl; wl = (watcher_object_list_t*)hashtable_remove(ht->ht, path); if (wl) { copy_watchers(wl, *list, 0); // Since we move, not clone the watch_objects, we just need to free the // head pointer free(wl); } }
static void copy_table(zk_hashtable *from, watcher_object_list_t *to) { struct hashtable_itr *it; int hasMore; if(hashtable_count(from->ht)==0) return; it=hashtable_iterator(from->ht); do { watcher_object_list_t *w = hashtable_iterator_value(it); copy_watchers(w, to, 1); hasMore=hashtable_iterator_advance(it); } while(hasMore); free(it); }
static void add_for_event(zk_hashtable *ht, char *path, watcher_object_list_t **list) { watcher_object_list_t* wl; #ifdef THREADED pthread_mutex_lock(&ht->lock); #endif wl = (watcher_object_list_t*)hashtable_remove(ht->ht, path); if (wl) { copy_watchers(wl, *list, 0); // Since we move, not clone the watch_objects, we just need to free the // head pointer free(wl); } #ifdef THREADED pthread_mutex_unlock(&ht->lock); #endif }