diff --git a/TODO b/TODO index c9790b1c..6aeee367 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,3 @@ -- try: - - $ vips avg broken.jpg[fail] - - about 50% of the time it'll trigger a range of out-of-order reads and lock - for 10s or so while seq times out - - add more webp tests to py suite - try moving some more of the CLI tests to py diff --git a/libvips/conversion/sequential.c b/libvips/conversion/sequential.c index c6a6bbfc..62b19c35 100644 --- a/libvips/conversion/sequential.c +++ b/libvips/conversion/sequential.c @@ -184,7 +184,7 @@ vips_sequential_generate( VipsRegion *or, /* Exit the loop on timeout or condition passes. We have to * be wary of spurious wakeups. */ - while( r->top > sequential->y_pos ) + while( r->top > sequential->y_pos ) { #ifdef HAVE_COND_INIT if( !g_cond_wait_until( sequential->ready, sequential->lock, time ) ) @@ -195,6 +195,14 @@ vips_sequential_generate( VipsRegion *or, break; #endif + /* We may have woken up because of an eval error. + */ + if( sequential->error ) { + g_mutex_unlock( sequential->lock ); + return( -1 ); + } + } + VIPS_GATE_STOP( "vips_sequential_generate: wait" ); VIPS_DEBUG_MSG_GREEN( "thread %p awake again ...\n", @@ -220,7 +228,7 @@ vips_sequential_generate( VipsRegion *or, area.width = 1; area.height = r->top - sequential->y_pos; if( vips_region_prepare( ir, &area ) ) { - VIPS_DEBUG_MSG( "thread %p error, unlocking ...\n", + VIPS_DEBUG_MSG( "thread %p error, unlocking #1 ...\n", g_thread_self() ); sequential->error = -1; g_cond_broadcast( sequential->ready ); @@ -237,7 +245,7 @@ vips_sequential_generate( VipsRegion *or, VIPS_DEBUG_MSG_GREEN( "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 error, unlocking ...\n", + VIPS_DEBUG_MSG( "thread %p error, unlocking #2 ...\n", g_thread_self() ); sequential->error = -1; g_cond_broadcast( sequential->ready );