mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-28 16:00:22 +02:00
* threads.scm: Added simple error and signal handler.
(make-thread, begin-handler): Use this handler. The most important effect of this is that signals get unmasked. Previously, when a signal was thrown signals remained masked (signals get masked when a signal is taken) which influenced other threads.
This commit is contained in:
parent
a3ec616e42
commit
13dc0cae2f
2 changed files with 34 additions and 2 deletions
|
@ -1,3 +1,12 @@
|
|||
1998-01-30 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
|
||||
|
||||
* threads.scm: Added simple error and signal handler.
|
||||
(make-thread, begin-handler): Use this handler. The most
|
||||
important effect of this is that signals get unmasked.
|
||||
Previously, when a signal was thrown signals remained masked
|
||||
(signals get masked when a signal is taken) which influenced other
|
||||
threads.
|
||||
|
||||
1998-01-01 Tim Pierce <twp@skepsis.com>
|
||||
|
||||
A better fix to the SLIB identity problem -- thanks to Marius Vollmer.
|
||||
|
|
|
@ -29,18 +29,41 @@
|
|||
|
||||
; --- MACROS -------------------------------------------------------
|
||||
|
||||
(define-public (%thread-handler tag . args)
|
||||
(fluid-set! the-last-stack #f)
|
||||
(unmask-signals)
|
||||
(let ((n (length args))
|
||||
(p (current-error-port)))
|
||||
(display "In thread:" p)
|
||||
(newline p)
|
||||
(if (>= n 3)
|
||||
(display-error #f
|
||||
p
|
||||
(car args)
|
||||
(cadr args)
|
||||
(caddr args)
|
||||
(if (= n 4)
|
||||
(cadddr args)
|
||||
'()))
|
||||
(begin
|
||||
(display "uncaught throw to " p)
|
||||
(display tag p)
|
||||
(display ": " p)
|
||||
(display args p)
|
||||
(newline p)))))
|
||||
|
||||
(defmacro-public make-thread (fn . args)
|
||||
`(call-with-new-thread
|
||||
(lambda ()
|
||||
(,fn ,@args))
|
||||
(lambda args args)))
|
||||
%thread-handler))
|
||||
|
||||
(defmacro-public begin-thread (first . thunk)
|
||||
`(call-with-new-thread
|
||||
(lambda ()
|
||||
(begin
|
||||
,first ,@thunk))
|
||||
(lambda args args)))
|
||||
%thread-handler))
|
||||
|
||||
(defmacro-public with-mutex (m . thunk)
|
||||
`(dynamic-wind
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue