io.monitors.recursive: don't bomb if a dsubordinate monitor is disposed of

release
Slava Pestov 2010-04-07 20:40:13 -04:00
parent 12f187d0eb
commit 85f3c69c70
1 changed files with 11 additions and 8 deletions

View File

@ -1,9 +1,10 @@
! Copyright (C) 2008, 2009 Slava Pestov. ! Copyright (C) 2008, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors sequences assocs arrays continuations USING: accessors sequences assocs arrays continuations
destructors combinators kernel threads concurrency.messaging destructors combinators kernel threads concurrency.messaging
concurrency.mailboxes concurrency.promises io.files io.files.info concurrency.mailboxes concurrency.promises io.files io.files.info
io.directories io.pathnames io.monitors debugger fry ; io.directories io.pathnames io.monitors io.monitors.private
debugger fry ;
IN: io.monitors.recursive IN: io.monitors.recursive
! Simulate recursive monitors on platforms that don't have them ! Simulate recursive monitors on platforms that don't have them
@ -71,12 +72,14 @@ M: recursive-monitor dispose*
] with with each ; ] with with each ;
: pump-loop ( -- ) : pump-loop ( -- )
receive dup +stop+ eq? [ receive {
drop stop-pump { [ dup +stop+ eq? ] [ drop stop-pump ] }
] [ { [ dup monitor-disposed eq? ] [ drop ] }
[ '[ _ update-hierarchy ] ignore-errors ] [ pump-step ] bi [
pump-loop [ '[ _ update-hierarchy ] ignore-errors ] [ pump-step ] bi
] if ; pump-loop
]
} cond ;
: monitor-ready ( error/t -- ) : monitor-ready ( error/t -- )
monitor tget ready>> fulfill ; monitor tget ready>> fulfill ;