cleanup_stale_locks Subroutine

public subroutine cleanup_stale_locks(cache_dir)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: cache_dir

Source Code

    subroutine cleanup_stale_locks(cache_dir)
        character(len=*), intent(in) :: cache_dir
        character(len=512) :: lock_files(1000)
        integer :: num_files, i

        ! Find all lock files in cache directory
        call sys_find_files(cache_dir, '*.lock', lock_files, num_files, .false., 1)

        ! Check each lock file
        do i = 1, num_files
            if (is_lock_stale(trim(lock_files(i)))) then
                call remove_lock(trim(lock_files(i)))
            end if
        end do

    end subroutine cleanup_stale_locks