Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions extensions/go-mode/go-mode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,10 @@
(defvar *fly-thread* nil)

(defun run-flymake (fn)
(when (and *fly-thread* (bt:thread-alive-p *fly-thread*))
(bt:destroy-thread *fly-thread*))
(when (and *fly-thread* (bt2:thread-alive-p *fly-thread*))
(bt2:destroy-thread *fly-thread*))
(setf *fly-thread*
(bt:make-thread fn :name "go-flymake")))
(bt2:make-thread fn :name "go-flymake")))

(define-command goflymake (buffer)
((current-buffer))
Expand Down
4 changes: 2 additions & 2 deletions extensions/lisp-mode/lisp-mode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -880,13 +880,13 @@
(defvar *wait-message-thread* nil)

(defun notify-change-connection-to-wait-message-thread ()
(bt:interrupt-thread *wait-message-thread*
(bt2:interrupt-thread *wait-message-thread*
(lambda () (error 'change-connection))))

(defun start-thread ()
(unless *wait-message-thread*
(setf *wait-message-thread*
(bt:make-thread
(bt2:make-thread
(lambda () (loop
:named exit
:do
Expand Down
2 changes: 1 addition & 1 deletion extensions/lisp-mode/v2/lsp-config.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
(micros:create-server :port port)))

(defun start-language-server (port)
(bt:make-thread (lambda ()
(bt2:make-thread (lambda ()
(lem-language-server:start-tcp-server port))))

(defmethod lem-lsp-mode::run-server ((spec lisp-spec))
Expand Down
4 changes: 2 additions & 2 deletions extensions/lsp-mode/lem-stdio-transport.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
(setf (transport-connection transport) connection)
(setf (transport-threads transport)
(list
(bt:make-thread
(bt2:make-thread
(lambda ()
(run-processing-loop transport connection))
:name "lem-lsp-mode/lem-stdio-transport processing")
(bt:make-thread
(bt2:make-thread
(lambda ()
(run-reading-loop transport connection))
:name "lem-lsp-mode/lem-stdio-transport reading")))
Expand Down
2 changes: 1 addition & 1 deletion extensions/lsp-mode/lsp-mode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@

(defun connect (client continuation)
(lem-lsp-base/yason-utils:update-jsonrpc-yason-parameters)
(bt:make-thread
(bt2:make-thread
(lambda ()
(loop :with condition := nil
:repeat 20
Expand Down
8 changes: 4 additions & 4 deletions extensions/scheme-mode/swank-connection.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -737,13 +737,13 @@
(defvar *wait-message-thread* nil)

(defun notify-change-connection-to-wait-message-thread ()
(bt:interrupt-thread *wait-message-thread*
(bt2:interrupt-thread *wait-message-thread*
(lambda () (error 'change-connection))))

(defun start-thread ()
(unless *wait-message-thread*
(setf *wait-message-thread*
(bt:make-thread
(bt2:make-thread
(lambda () (loop
:named exit
:do
Expand Down Expand Up @@ -975,7 +975,7 @@
(write-line "(loop (sleep most-positive-fixnum))" out)))

(defun run-swank-server (command port &key (directory (buffer-directory)))
(bt:make-thread
(bt2:make-thread
(lambda ()
(with-input-from-string
(input (initialize-forms-string port))
Expand Down Expand Up @@ -1023,7 +1023,7 @@

(let ((thread (run-swank-server command port :directory directory)))
(sleep 0.5)
(unless (bt:thread-alive-p thread)
(unless (bt2:thread-alive-p thread)
(editor-error "Scheme swank server start error")))

(let ((successp)
Expand Down
6 changes: 3 additions & 3 deletions frontends/ncurses/mainloop.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(loop
(handler-case
(progn
(unless (bt:thread-alive-p editor-thread) (return))
(unless (bt2:thread-alive-p editor-thread) (return))
(let ((event (lem-ncurses/input:get-event)))
(if (eq event :abort)
(send-abort-event editor-thread nil)
Expand All @@ -27,7 +27,7 @@

(defun invoke (function)
(let ((result nil)
(input-thread (bt:current-thread)))
(input-thread (bt2:current-thread)))
(unwind-protect
(when (lem-ncurses/term:term-init)
(let ((*standard-output* (make-broadcast-stream))
Expand All @@ -37,7 +37,7 @@
(funcall function
nil
(lambda (report)
(bt:interrupt-thread
(bt2:interrupt-thread
input-thread
(lambda () (error 'exit :value report)))))))
(setf result (input-loop editor-thread)))))
Expand Down
10 changes: 5 additions & 5 deletions frontends/pdcurses/ncurses-pdcurseswin32.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,15 @@
;; for resizing display
(defkeycode "[resize]" #x222)
(let ((resize-delay-counter 0)
(lock (bt:make-lock)))
(lock (bt2:make-lock)))
(defun now-resizing ()
(bt:with-lock-held (lock)
(bt2:with-lock-held (lock)
resize-delay-counter))
(defun (setf now-resizing) (v)
(bt:with-lock-held (lock)
(bt2:with-lock-held (lock)
(setf resize-delay-counter v)))
(defun now-resizing-countdown ()
(bt:with-lock-held (lock)
(bt2:with-lock-held (lock)
(decf resize-delay-counter))))
(defvar *min-cols* 5)
(defvar *min-lines* 3)
Expand Down Expand Up @@ -709,7 +709,7 @@
(loop
(handler-case
(progn
(unless (bt:thread-alive-p editor-thread) (return))
(unless (bt2:thread-alive-p editor-thread) (return))
(let ((event (get-event)))
(case event
;; retry is necessary to exit lem normally
Expand Down
6 changes: 3 additions & 3 deletions frontends/sdl2/display.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
`(call-with-display (lambda (,display) ,@body)))

(defclass display ()
((mutex :initform (bt:make-lock "lem-sdl2 display mutex")
((mutex :initform (bt2:make-lock :name "lem-sdl2 display mutex")
:reader display-mutex)
(font-config :initarg :font-config
:accessor display-font-config)
Expand Down Expand Up @@ -108,7 +108,7 @@

(defun call-with-renderer (display function)
(sdl2:in-main-thread ()
(bt:with-recursive-lock-held ((display-mutex display))
(bt2:with-recursive-lock-held ((display-mutex display))
(funcall function))))

(defmacro with-renderer ((display) &body body)
Expand Down Expand Up @@ -174,7 +174,7 @@
(nth-value 1 (sdl2:get-window-size (display-window display))))

(defmethod update-texture ((display display))
(bt:with-lock-held ((display-mutex display))
(bt2:with-lock-held ((display-mutex display))
(sdl2:destroy-texture (display-texture display))
(setf (display-texture display)
(utils:create-texture (display-renderer display)
Expand Down
4 changes: 2 additions & 2 deletions lib/language-client/request.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
(cl-package-locks:lock-package :lem-lsp-mode/request)

(defvar *log-enable* t)
(defvar *log-mutex* (bt:make-lock))
(defvar *log-mutex* (bt2:make-lock))

(defun do-log (string &rest args)
(when *log-enable*
(bt:with-lock-held (*log-mutex*)
(bt2:with-lock-held (*log-mutex*)
(let ((log-pathname (merge-pathnames "language-client.log" (lem:lem-logdir-pathname))))
(ensure-directories-exist log-pathname)
(with-open-file (out log-pathname
Expand Down
6 changes: 2 additions & 4 deletions lib/lsp-base/yason-utils.lisp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
(defpackage :lem-lsp-base/yason-utils
(:use :cl)
(:import-from :bordeaux-threads
:*default-special-bindings*)
(:export :with-yason-bindings
:update-jsonrpc-yason-parameters
:parse-json))
Expand All @@ -15,9 +13,9 @@
`(call-with-yason-bindings (lambda () ,@body)))

(defun call-with-yason-bindings (function)
(let ((*default-special-bindings*
(let ((bt2:*default-special-bindings*
(append *yason-bindings*
*default-special-bindings*)))
bt2:*default-special-bindings*)))
(progv (mapcar #'car *yason-bindings*)
(mapcar #'cdr *yason-bindings*)
(funcall function))))
Expand Down
6 changes: 3 additions & 3 deletions lib/process/process.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
;; :read-thread thread
:output-callback output-callback
:output-callback-type output-callback-type))
(thread (bt:make-thread
(thread (bt2:make-thread
(lambda ()
(loop
(unless (async-process:process-alive-p pointer)
Expand Down Expand Up @@ -65,8 +65,8 @@
(funcall output-callback string))))))

(defun delete-process (process)
(when (bt:thread-alive-p (process-read-thread process))
(bt:destroy-thread (process-read-thread process)))
(when (bt2:thread-alive-p (process-read-thread process))
(bt2:destroy-thread (process-read-thread process)))
(async-process:delete-process (process-pointer process)))

(defun process-alive-p (process)
Expand Down
2 changes: 1 addition & 1 deletion src/buffer/interrupt.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
(setf *interrupted* nil)
(error 'lem/buffer/errors:editor-interrupt)))))))

;; 別のスレッドから(bt:interrupt-thread thread #'interrupt)で使う関数
;; 別のスレッドから(bt2:interrupt-thread thread #'interrupt)で使う関数
(defun interrupt (&optional force)
(cond
(force
Expand Down
10 changes: 5 additions & 5 deletions src/commands/file.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@
If finding files times out, such as in a HOME directory, stop the operation.

Return a list of files or signal a FALLBACK-TO-FIND-FILE simple condition."
(let ((thread (bt:make-thread
(let ((thread (bt2:make-thread
(lambda ()
(get-files-recursively find-program))
:name "Lem get-files-recursively")))
(handler-case
(bt:with-timeout (timeout)
(bt:join-thread thread))
(bt:timeout ()
(bt:destroy-thread thread)
(bt2:with-timeout (timeout)
(bt2:join-thread thread))
(bt2:timeout ()
(bt2:destroy-thread thread)
(signal 'fallback-to-find-file)))))

(defun prompt-for-files-recursively ()
Expand Down
16 changes: 8 additions & 8 deletions src/common/queue.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,30 @@
(null (queue-list queue)))

(defstruct (concurrent-queue (:constructor %make-concurrent-queue))
(wait (bt:make-condition-variable))
(lock (bt:make-lock))
(wait (bt2:make-condition-variable))
(lock (bt2:make-lock))
(queue (make-queue)))

(defun make-concurrent-queue ()
(%make-concurrent-queue))

(defmethod len ((queue concurrent-queue))
(bt:with-lock-held ((concurrent-queue-lock queue))
(bt2:with-lock-held ((concurrent-queue-lock queue))
(len (concurrent-queue-queue queue))))

(defmethod enqueue ((queue concurrent-queue) obj)
(bt:with-lock-held ((concurrent-queue-lock queue))
(bt2:with-lock-held ((concurrent-queue-lock queue))
(enqueue (concurrent-queue-queue queue) obj)
(bt:condition-notify (concurrent-queue-wait queue))))
(bt2:condition-notify (concurrent-queue-wait queue))))

(defmethod dequeue ((queue concurrent-queue) &key timeout timeout-value)
(bt:with-lock-held ((concurrent-queue-lock queue))
(bt2:with-lock-held ((concurrent-queue-lock queue))
(if (not (empty-p (concurrent-queue-queue queue)))
(dequeue (concurrent-queue-queue queue))
(cond ((if timeout
(bt:condition-wait (concurrent-queue-wait queue) (concurrent-queue-lock queue)
(bt2:condition-wait (concurrent-queue-wait queue) (concurrent-queue-lock queue)
:timeout timeout)
(bt:condition-wait (concurrent-queue-wait queue) (concurrent-queue-lock queue)))
(bt2:condition-wait (concurrent-queue-wait queue) (concurrent-queue-lock queue)))
(dequeue (concurrent-queue-queue queue)))
(t
timeout-value)))))
16 changes: 8 additions & 8 deletions src/common/timer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,24 @@
(defclass timer (<timer>)
((mutex
:accessor timer-mutex
:type bt:lock)
:type bt2:lock)
(stop-mailbox
:accessor timer-stop-mailbox
:type lem-mailbox:mailbox)
(thread
:accessor timer-thread
:type bt:thread)))
:type bt2:thread)))

(defmethod timer-expired-p ((timer timer))
(bt:with-lock-held ((timer-mutex timer))
(bt2:with-lock-held ((timer-mutex timer))
(call-next-method)))

(defmethod expire-timer ((timer timer))
(bt:with-lock-held ((timer-mutex timer))
(bt2:with-lock-held ((timer-mutex timer))
(set-timer-expired-p t timer)))

(defmethod inspire-timer ((timer timer))
(bt:with-lock-held ((timer-mutex timer))
(bt2:with-lock-held ((timer-mutex timer))
(set-timer-expired-p nil timer)))

(defun make-timer (function &key name handle-function)
Expand All @@ -138,8 +138,8 @@
(defmethod start-timer ((timer timer) ms &key repeat)
(setf (timer-ms timer) ms
(timer-repeat-p timer) repeat
(timer-mutex timer)
(bt:make-lock "timer internal mutex"))
(timer-mutex timer)
(bt2:make-lock :name "timer internal mutex"))
(start-timer-thread timer ms repeat)
timer)

Expand All @@ -153,7 +153,7 @@
(setf (timer-stop-mailbox timer)
stop-mailbox)
(setf (timer-thread timer)
(bt:make-thread
(bt2:make-thread
(lambda ()
(loop
(let ((recv-stop-msg
Expand Down
2 changes: 1 addition & 1 deletion src/event-queue.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(enqueue *editor-event-queue* obj))

(defun send-abort-event (editor-thread force)
(bt:interrupt-thread editor-thread
(bt2:interrupt-thread editor-thread
(lambda ()
(interrupt force))))

Expand Down
4 changes: 2 additions & 2 deletions src/interface.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@

(defmacro with-implementation (implementation &body body)
`(let* ((*implementation* ,implementation)
(bt:*default-special-bindings*
(bt2:*default-special-bindings*
(acons '*implementation*
*implementation*
bt:*default-special-bindings*)))
bt2:*default-special-bindings*)))
,@body))

(defun display-background-mode ()
Expand Down
2 changes: 1 addition & 1 deletion src/interp.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
(signal 'exit-editor :report report))

(defun call-background-job (function cont)
(bt:make-thread
(bt2:make-thread
(lambda ()
(let ((error-text))
(handler-case
Expand Down
Loading