Function: image-dired-thumb-queue-run

image-dired-thumb-queue-run is a byte-compiled function defined in image-dired-external.el.gz.

Signature

(image-dired-thumb-queue-run)

Documentation

Run a queued job if one exists and not too many jobs are running.

Queued items live in image-dired-queue. Number of simultaneous jobs is limited by image-dired-queue-active-limit.

Source Code

;; Defined in /usr/src/emacs/lisp/image/image-dired-external.el.gz
(defun image-dired-thumb-queue-run ()
  "Run a queued job if one exists and not too many jobs are running.
Queued items live in `image-dired-queue'.
Number of simultaneous jobs is limited by `image-dired-queue-active-limit'."
  (if (not (eq (image-dired--check-executable-exists
                'image-dired-cmd-create-thumbnail-program
                'w32image-create-thumbnail)
               'function))
      ;; We have a usable gm/convert command; queue thethumbnail jobs.
      (let ((max-jobs
             (if (eq system-type 'windows-nt)
                 ;; Can't have more than 32 concurrent sub-processes on
                 ;; MS-Windows.
                 (min 30 image-dired-queue-active-limit)
               image-dired-queue-active-limit)))
        (while (and image-dired-queue
                    (< image-dired-queue-active-jobs max-jobs))
          (incf image-dired-queue-active-jobs)
          (apply #'image-dired-create-thumb-1 (pop image-dired-queue))))
    ;; We are on MS-Windows with ImageMagick/GraphicsMagick, and need to
    ;; generate thumbnails by our lonesome selves.
    (if image-dired-queue
        (let* ((job (pop image-dired-queue))
               (orig-file (car job))
               (thumb-file (cadr job)))
          (run-with-timer 0.05 nil
                          #'image-dired-create-thumb-2
                          orig-file thumb-file)))))