ui: try and ensure that the ui thread finishes #1905

factor-shell
Björn Lindqvist 2018-01-29 07:55:36 +01:00
parent dd36f6ad57
commit 62542c52a9
2 changed files with 14 additions and 1 deletions

9
basis/ui/ui-tests.factor Normal file
View File

@ -0,0 +1,9 @@
USING: assocs kernel threads tools.test ui ;
IN: ui.tests
{ t } [
! with-ui shouldn't leave any thread hanging around.
threads assoc-size
[ ] with-ui
threads assoc-size =
] unit-test

View File

@ -224,7 +224,11 @@ M: object resize-window 2drop ;
ui-running? [ call( -- ) ] [
t ui-running set-global '[
[ init-ui @ ] (with-ui)
] [ f ui-running set-global ] [ ] cleanup
] [
f ui-running set-global
! Give running ui threads a chance to finish.
notify-ui-thread yield
] [ ] cleanup
] if ;
HOOK: beep ui-backend ( -- )