- while ((ci->flags & CI_FLAGS_IN_QUEUE) != 0)
- {
- ci = NULL;
-
- pthread_cond_wait (&flush_cond, &cache_lock);
-
- ci = g_tree_lookup (cache_tree, filename);
- if (ci == NULL)
- {
- RRDD_LOG (LOG_ERR, "flush_file: Tree node went away "
- "while waiting for flush.");
- pthread_mutex_unlock (&cache_lock);
- return (-1);
- }
- }
+ pthread_cond_wait(&ci->flushed, &cache_lock);
+ pthread_mutex_unlock(&cache_lock);