From: Jaroslav Kysela Date: Wed, 21 May 2014 12:25:00 +0000 (+0200) Subject: timeshift_filemgr: move the reaper lock to the end of loop to save the lock time X-Git-Tag: v4.1~2072 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd6b47dcf8c4d871bf4106aaf7d15fd0dd29e453;p=thirdparty%2Ftvheadend.git timeshift_filemgr: move the reaper lock to the end of loop to save the lock time .... as suggested by Adam --- diff --git a/src/timeshift/timeshift_filemgr.c b/src/timeshift/timeshift_filemgr.c index d33be2810..19f19bb74 100644 --- a/src/timeshift/timeshift_filemgr.c +++ b/src/timeshift/timeshift_filemgr.c @@ -73,8 +73,6 @@ static void* timeshift_reaper_callback ( void *p ) tvhlog(LOG_ERR, "timeshift", "failed to remove %s [e=%s]", dpath, strerror(errno)); - pthread_mutex_lock(×hift_reaper_lock); - /* Free memory */ while ((ti = TAILQ_FIRST(&tsf->iframes))) { TAILQ_REMOVE(&tsf->iframes, ti, link); @@ -88,6 +86,8 @@ static void* timeshift_reaper_callback ( void *p ) } free(tsf->path); free(tsf); + + pthread_mutex_lock(×hift_reaper_lock); } pthread_mutex_unlock(×hift_reaper_lock); tvhtrace("timeshift", "reaper thread exit");