From 9a75754282a830ac000c9af3ad53223836190a62 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 4 Sep 2006 08:16:33 +0000 Subject: [PATCH] fixed logic for starting the idle swapper --- app/base/tile-cache.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/base/tile-cache.c b/app/base/tile-cache.c index d09d758122..75396ceede 100644 --- a/app/base/tile-cache.c +++ b/app/base/tile-cache.c @@ -28,11 +28,6 @@ #include "tile-private.h" -/* This is the percentage of the maximum cache size that should be cleared - * from the cache when an eviction is necessary - */ -#define FREE_QUANTUM 0.1 - #define IDLE_SWAPPER_TIMEOUT 250 @@ -114,11 +109,13 @@ tile_cache_init (gulong tile_cache_size) void tile_cache_exit (void) { +#ifndef ENABLE_THREADED_TILE_SWAPPER if (idle_swapper) { g_source_remove (idle_swapper); idle_swapper = 0; } +#endif tile_cache_set_size (0); } @@ -214,11 +211,14 @@ tile_cache_insert (Tile *tile) g_cond_signal (dirty_signal); g_mutex_unlock (dirty_mutex); #else - if (! idle_swapper && cur_cache_dirty * 2 < max_cache_size) - idle_swapper = g_timeout_add_full (G_PRIORITY_LOW, - IDLE_SWAPPER_TIMEOUT, - tile_idle_preswap, - NULL, NULL); + if (! idle_swapper && + cur_cache_dirty * 2 > max_cache_size) + { + idle_swapper = g_timeout_add_full (G_PRIORITY_LOW, + IDLE_SWAPPER_TIMEOUT, + tile_idle_preswap, + NULL, NULL); + } #endif }