X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fcache.C;h=de8563a96e26013cdcb599b34e29c5651847bf37;hp=7fed3e68a4cb833a42ec7dd65e238ac39762f90f;hb=4a90ef3ae46465c0634f81916b79e279e4bd9961;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd diff --git a/cinelerra-5.1/cinelerra/cache.C b/cinelerra-5.1/cinelerra/cache.C index 7fed3e68..de8563a9 100644 --- a/cinelerra-5.1/cinelerra/cache.C +++ b/cinelerra-5.1/cinelerra/cache.C @@ -43,6 +43,7 @@ CICache::CICache(Preferences *preferences) edl = 0; check_out_lock = new Condition(0, "CICache::check_out_lock", 0); total_lock = new Mutex("CICache::total_lock"); + check_outs = 0; } CICache::~CICache() @@ -106,6 +107,8 @@ SET_TRACE current->age = EDL::next_id(); current->checked_out = tid; } + else if( current->checked_out == tid ) + ++check_outs; else current = 0; } @@ -122,13 +125,17 @@ SET_TRACE int CICache::check_in(Asset *asset) { total_lock->lock("CICache::check_in"); - CICacheItem *current = first; - while(current && strcmp(current->asset->path, asset->path) != 0) - current = NEXT; - if(current && current->checked_out) { - current->checked_out = 0; - current->Garbage::remove_user(); + if( !check_outs ) { + CICacheItem *current = first; + while(current && strcmp(current->asset->path, asset->path) != 0) + current = NEXT; + if(current && current->checked_out) { + current->checked_out = 0; + current->Garbage::remove_user(); + } } + else + --check_outs; total_lock->unlock(); // Release for blocking check_out operations