run init-executables-completion-set! in a seperate thread

This commit is contained in:
eknauel 2005-05-30 15:21:40 +00:00
parent 2723409aed
commit eeaaa729ac
1 changed files with 16 additions and 3 deletions

View File

@ -7,6 +7,12 @@
(begin ?do-this ... (values))
(values)))))
(define (with-lock lock thunk)
(obtain-lock lock)
(let ((val (thunk)))
(release-lock lock)
val))
;;This is the "heart" of NUIT.
;;In a central loop the program waits for input (with wgetch).
;;In the upper buffer simply the functionalities of scsh-ncurses:
@ -42,6 +48,7 @@
(define result-window #f)
(define result-frame-window #f)
(define executable-completions-lock (make-lock))
(define executable-completions #f)
(define key-control-x 24)
@ -475,8 +482,12 @@
'("/usr/bin" "/bin" "/usr/sbin" "/sbin"))))
(define (init-executables-completion-set!)
(set! executable-completions
(make-completion-set-for-executables (get-path-list))))
(spawn
(lambda ()
(with-lock executable-completions-lock
(lambda()
(set! executable-completions
(make-completion-set-for-executables (get-path-list))))))))
(define (paint-bar-1)
(mvwaddstr (app-window-curses-win bar-1) 0 1 "SCSH-NUIT")
@ -828,7 +839,9 @@
(else
(append
(completions-for (command-completions) prefix)
(completions-for-executables executable-completions prefix)))))
(with-lock executable-completions-lock
(lambda ()
(completions-for-executables executable-completions prefix)))))))
(define (assemble-line-with-completion command arg arg-pos completion)
(debug-message "assemble-line-with-completion "