void task_processor_clear_task_queue( task_processor* processor ) { hash_map_iterator iter_queue; list_iterator iter_event; event_group_element_type group_element = NULL; task_queue* queue = NULL; synchronize_lock_mutex( processor->mutex ); HASH_MAP_ITERATOR_START( iter_queue, &processor->task_queues ); while ( HASH_MAP_ITERATOR_IS_VALID( iter_queue ) ) { group_element = *(event_group_element_type*)HASH_MAP_ITERATOR_GET( iter_queue ); queue = *(task_queue**)hash_map_get( &processor->task_queues, &group_element ); synchronize_lock_mutex( queue->mutex ); LIST_ITERATOR_START( iter_event, &queue->event_list ); while ( LIST_ITERATOR_IS_VALID( iter_event ) ) { if ( group_element == *(event_group_element_type*)LIST_ITERATOR_GET( iter_event ) ) { list_remove( &queue->event_list, iter_event ); break; } LIST_ITERATOR_NEXT( iter_event ); } synchronize_unlock_mutex( queue->mutex ); ASSERT( synchronize_event_group_get_group_by_element( group_element ) == processor->event_group ); synchronize_event_group_remove_element( processor->event_group, group_element ); HASH_MAP_ITERATOR_NEXT( iter_queue ); } hash_map_clear( &processor->task_queues ); synchronize_unlock_mutex( processor->mutex ); }
void test_clear() { hash_map_put(map, "key", "value"); hash_map_put(map, "key2", "value2"); hash_map_put(map, "key3", "value3"); hash_map_clear(map); TEST_ASSERT_EQUAL_UINT(0, hash_map_size(map)); TEST_ASSERT_NULL(hash_map_get(map, "key")); TEST_ASSERT_NULL(hash_map_get(map, "key2")); TEST_ASSERT_NULL(hash_map_get(map, "key3")); }
static void background_connections_clear() { if (background_connections) hash_map_clear(background_connections); }
void explore_node_map_clear( explore_node_map* map ) { hash_map_clear( &map->nodes ); object_pool_clear( &map->node_pool ); }