|
202 | 202 |
|
203 | 203 | (define output-port (mk-port plain-style))
|
204 | 204 | (define error-port (mk-port error-style))
|
205 |
| - |
| 205 | + |
| 206 | + ;; accessed and mutated only on the handler thread of `orig-eventspace` |
206 | 207 | (define completed-successfully? #f)
|
207 | 208 |
|
208 | 209 | (define installer-cust (make-custodian))
|
209 |
| - |
| 210 | + (thread |
| 211 | + (lambda () |
| 212 | + (sync (make-custodian-box installer-cust #t)) |
| 213 | + (parameterize ([current-eventspace inst-eventspace]) |
| 214 | + (queue-callback |
| 215 | + (λ () |
| 216 | + (send kill-button enable #f) |
| 217 | + (when close-button (send close-button enable #t)) |
| 218 | + (set! currently-can-close? #t) |
| 219 | + (semaphore-post can-close-sema)))) |
| 220 | + (parameterize ([current-eventspace orig-eventspace]) |
| 221 | + (queue-callback |
| 222 | + (lambda () |
| 223 | + (unless completed-successfully? |
| 224 | + (cleanup-thunk))))))) |
| 225 | + |
210 | 226 | (parameterize ([current-custodian installer-cust])
|
211 | 227 | (parameterize ([current-eventspace (make-eventspace)])
|
212 | 228 | (queue-callback
|
213 | 229 | (lambda ()
|
214 | 230 |
|
215 |
| - (let ([installer-thread (current-thread)]) |
216 |
| - (parameterize ([current-custodian orig-custodian]) |
217 |
| - (thread |
218 |
| - (lambda () |
219 |
| - (sync (make-custodian-box installer-cust #t)) |
220 |
| - (parameterize ([current-eventspace inst-eventspace]) |
221 |
| - (queue-callback |
222 |
| - (λ () |
223 |
| - (send kill-button enable #f) |
224 |
| - (when close-button (send close-button enable #t)) |
225 |
| - (set! currently-can-close? #t) |
226 |
| - (semaphore-post can-close-sema)))) |
227 |
| - (unless completed-successfully? |
228 |
| - (parameterize ([current-eventspace orig-eventspace]) |
229 |
| - (queue-callback |
230 |
| - (lambda () |
231 |
| - (cleanup-thunk))))))))) |
232 |
| - |
233 | 231 | (let/ec k
|
234 | 232 | (parameterize ([current-output-port output-port]
|
235 | 233 | [current-error-port error-port]
|
|
0 commit comments