Skip to content

Commit

Permalink
start: Make start-browser synchronous.
Browse files Browse the repository at this point in the history
There is no point in having it asynchronous, since anything run in parallel
before browser is ready is likely to trigger a race conditions or undefined
behaviour.

It simplifies testing a lot.
  • Loading branch information
Ambrevar committed Jan 11, 2023
1 parent b0af4f4 commit ffa70b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions source/browser.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ issued by Control+<button1> in a new window.")
(time:now)
:export nil
:documentation "`time:timestamp' of when Nyxt was started.")
(startup-promise
(lpara:promise)
:export nil
:accessor nil
:documentation "")
(init-time
0.0
:type alex:non-negative-real
Expand Down Expand Up @@ -390,6 +395,7 @@ restored."
(error (c)
;; TODO: Clear buffers or back up history?
(log:warn c)))
(lpara:fulfill (slot-value browser 'startup-promise))
(hooks:run-hook (after-startup-hook browser) browser)
(funcall* (startup-error-reporter-function browser)))))

Expand Down
3 changes: 2 additions & 1 deletion source/start.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,8 @@ Finally, run the browser, load URL-STRINGS if any, then run
;; is the case with the SLY mrepl thread.
(bt:make-thread (lambda ()
(in-package :nyxt-user)))
(ffi-initialize *browser* urls startup-timestamp))))
(ffi-initialize *browser* urls startup-timestamp)
(lpara:force (slot-value *browser* 'startup-promise)))))
(quit ()
:report "Run `nyxt:quit' and try again."
(quit)
Expand Down

0 comments on commit ffa70b9

Please sign in to comment.