argh still deadlocks on example.rb

This commit is contained in:
John Cupitt 2012-09-04 14:56:22 +01:00
parent 4ef825014d
commit 0c87863222
9 changed files with 41 additions and 13 deletions

View File

@ -1,3 +1,6 @@
4/9/12 started 7.30.2
- sequential stops all threads on error
6/8/12 started 7.30.1
- fixes to dzsave: shrink down to a 1x1 pixel tile, round image size up on
shrink, write a .dzi file with the pyramid params, default tile size and

2
TODO
View File

@ -1,3 +1,5 @@
- still deadlocks on example.rb
blocking bugs
=============

View File

@ -2,7 +2,7 @@
# also update the version number in the m4 macros below
AC_INIT([vips], [7.30.1], [vipsip@jiscmail.ac.uk])
AC_INIT([vips], [7.30.2], [vipsip@jiscmail.ac.uk])
# required for gobject-introspection
AC_PREREQ(2.62)
@ -17,7 +17,7 @@ AC_CONFIG_MACRO_DIR([m4])
# user-visible library versioning
m4_define([vips_major_version], [7])
m4_define([vips_minor_version], [30])
m4_define([vips_micro_version], [1])
m4_define([vips_micro_version], [2])
m4_define([vips_version],
[vips_major_version.vips_minor_version.vips_micro_version])
@ -37,7 +37,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
# binary interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=33
LIBRARY_REVISION=4
LIBRARY_REVISION=5
LIBRARY_AGE=1
# patched into include/vips/version.h

View File

@ -402,12 +402,11 @@ vips_embed_build( VipsObject *object )
if( vips_image_copy_fields( conversion->out, embed->in ) )
return( -1 );
/* embed is used in many places. SMALLTILE would force most
* pipelines into SMALLTILE mode, so stick with THINSTRIP,
* even though SMALLTILE might be a little faster for us.
/* embed is used in many places. We don't really care about
* geometry, so use ANY to avoid disturbing all pipelines.
*/
vips_demand_hint( conversion->out,
VIPS_DEMAND_STYLE_FATSTRIP, embed->in, NULL );
VIPS_DEMAND_STYLE_ANY, embed->in, NULL );
conversion->out->Xsize = embed->width;
conversion->out->Ysize = embed->height;

View File

@ -285,7 +285,7 @@ vips_insert_build( VipsObject *object )
if( vips_image_copy_fields_array( conversion->out, arry ) )
return( -1 );
vips_demand_hint_array( conversion->out,
VIPS_DEMAND_STYLE_SMALLTILE, arry );
VIPS_DEMAND_STYLE_ANY, arry );
/* Calculate geometry.
*/

View File

@ -13,6 +13,8 @@
* - remove skip forward, instead do thread stalling and have an
* integrated cache
* - use linecache
* 4/9/12
* - stop all threads on error
*/
/*
@ -77,6 +79,11 @@ typedef struct _VipsSequential {
* when we start.
*/
int y_pos;
/* If one thread gets an error, we must stop all threads, otherwise we
* can stall and never wake.
*/
int error;
} VipsSequential;
typedef VipsConversionClass VipsSequentialClass;
@ -115,6 +122,13 @@ retry:
VIPS_DEBUG_MSG( "thread %p has lock ...\n", g_thread_self() );
/* If we've seen an error, everything must stop or we'll deadlock.
*/
if( sequential->error ) {
g_mutex_unlock( sequential->lock );
return( -1 );
}
if( r->top > sequential->y_pos &&
sequential->y_pos > 0 ) {
/* We have started reading (y_pos > 0) and this request is for
@ -144,8 +158,14 @@ retry:
area.top = sequential->y_pos;
area.width = 1;
area.height = r->top - sequential->y_pos;
if( vips_region_prepare( ir, &area ) )
if( vips_region_prepare( ir, &area ) ) {
VIPS_DEBUG_MSG( "thread %p error, unlocking ...\n",
g_thread_self() );
sequential->error = -1;
g_cond_broadcast( sequential->ready );
g_mutex_unlock( sequential->lock );
return( -1 );
}
sequential->y_pos = VIPS_RECT_BOTTOM( &area );
}
@ -156,7 +176,10 @@ retry:
VIPS_DEBUG_MSG( "thread %p reading ...\n", g_thread_self() );
if( vips_region_prepare( ir, r ) ||
vips_region_region( or, ir, r, r->left, r->top ) ) {
VIPS_DEBUG_MSG( "thread %p unlocking ...\n", g_thread_self() );
VIPS_DEBUG_MSG( "thread %p error, unlocking ...\n",
g_thread_self() );
sequential->error = -1;
g_cond_broadcast( sequential->ready );
g_mutex_unlock( sequential->lock );
return( -1 );
}
@ -262,6 +285,7 @@ vips_sequential_init( VipsSequential *sequential )
sequential->lock = g_mutex_new();
sequential->ready = g_cond_new();
sequential->tile_height = 1;
sequential->error = 0;
}
/**

View File

@ -401,7 +401,7 @@ im_tile_cache( IMAGE *in, IMAGE *out,
if( im_piocheck( in, out ) ||
im_cp_desc( out, in ) ||
im_demand_hint( out, IM_SMALLTILE, in, NULL ) ||
im_demand_hint( out, IM_ANY, in, NULL ) ||
!(read = read_new( in, out,
tile_width, tile_height, max_tiles )) ||
im_generate( out,

View File

@ -325,7 +325,7 @@ vips_demand_hint_array( VipsImage *image, VipsDemandStyle hint, VipsImage **in )
#ifdef DEBUG
printf( "vips_demand_hint_array: set dhint for \"%s\" to %s\n",
im->filename,
image->filename,
vips_enum_nick( VIPS_TYPE_DEMAND_STYLE, image->dhint ) );
printf( "\toperation requested %s\n",
vips_enum_nick( VIPS_TYPE_DEMAND_STYLE, hint ) );

View File

@ -48,7 +48,7 @@
static int thumbnail_size = 128;
static char *output_format = "tn_%s.jpg";
static char *interpolator = "bilinear";;
static char *interpolator = "bilinear";
static gboolean nosharpen = FALSE;
static char *export_profile = NULL;
static char *import_profile = NULL;