Commit 1e9108c4 authored by scott's avatar scott
Browse files

Squashed a deadlock. I hope. --sg

parent 72577b16
Tue Jul 21 18:32:19 1998 Scott Goehring <scott@poverty.bloomington.in.us>
* app/tile.c app/tile_swap.c: Squashed a deadlock. I hope.
Tue Jul 21 02:11:47 MEST 1998 Sven Neumann <sven@gimp.org>
* app/app_procs.c
......
......@@ -449,6 +449,9 @@ tile_swap_default_in_async (DefSwapFile *def_swap_file,
* I'm not sure that it is worthwhile to try to pull out common
* bits; I think the two functions are (at least for now) different
* enough to keep as two functions.
*
* N.B. the mutex on the tile must already have been locked on entry
* to this function. DO NOT LOCK IT HERE.
*/
static void
tile_swap_default_in (DefSwapFile *def_swap_file,
......@@ -462,10 +465,8 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
err = -1;
TILE_MUTEX_LOCK (tile);
if (tile->data)
{
TILE_MUTEX_UNLOCK (tile);
return;
}
......@@ -509,9 +510,6 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
/* Do not delete the swap from the file */
/* tile_swap_default_delete (def_swap_file, fd, tile); */
/* FIXME: can this be moved upwards? */
TILE_MUTEX_UNLOCK (tile);
read_err_msg = seek_err_msg = TRUE;
}
......
......@@ -87,13 +87,14 @@ tile_lock (Tile *tile)
/* remove from cache, move to main store */
tile_cache_flush (tile);
}
if (tile->data == NULL)
{
/* There is no data, so the tile must be swapped out */
tile_swap_in (tile);
}
tile_active_count ++;
}
if (tile->data == NULL)
{
/* There is no data, so the tile must be swapped out */
tile_swap_in (tile);
}
TILE_MUTEX_UNLOCK (tile);
/* Call 'tile_manager_validate' if the tile was invalid.
......@@ -103,6 +104,8 @@ tile_lock (Tile *tile)
/* an invalid tile should never be shared, so this should work */
tile_manager_validate ((TileManager*) tile->tlink->tm, tile);
}
}
......
......@@ -87,13 +87,14 @@ tile_lock (Tile *tile)
/* remove from cache, move to main store */
tile_cache_flush (tile);
}
if (tile->data == NULL)
{
/* There is no data, so the tile must be swapped out */
tile_swap_in (tile);
}
tile_active_count ++;
}
if (tile->data == NULL)
{
/* There is no data, so the tile must be swapped out */
tile_swap_in (tile);
}
TILE_MUTEX_UNLOCK (tile);
/* Call 'tile_manager_validate' if the tile was invalid.
......@@ -103,6 +104,8 @@ tile_lock (Tile *tile)
/* an invalid tile should never be shared, so this should work */
tile_manager_validate ((TileManager*) tile->tlink->tm, tile);
}
}
......
......@@ -449,6 +449,9 @@ tile_swap_default_in_async (DefSwapFile *def_swap_file,
* I'm not sure that it is worthwhile to try to pull out common
* bits; I think the two functions are (at least for now) different
* enough to keep as two functions.
*
* N.B. the mutex on the tile must already have been locked on entry
* to this function. DO NOT LOCK IT HERE.
*/
static void
tile_swap_default_in (DefSwapFile *def_swap_file,
......@@ -462,10 +465,8 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
err = -1;
TILE_MUTEX_LOCK (tile);
if (tile->data)
{
TILE_MUTEX_UNLOCK (tile);
return;
}
......@@ -509,9 +510,6 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
/* Do not delete the swap from the file */
/* tile_swap_default_delete (def_swap_file, fd, tile); */
/* FIXME: can this be moved upwards? */
TILE_MUTEX_UNLOCK (tile);
read_err_msg = seek_err_msg = TRUE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment