Hello,

I made a short program (see below) to demonstrate the problem:

as soon as I call (gtk-main), all other threads are quickly frozen. From
another application we have, creating new threads

I now that guile 1.6.1 has strange problems with threads, but this seems
to me a bit too far, like gtk would lock the complete guile interpreter.

Thanks for any help in advance!

Kind regards,

Stan.

;;
;;some test code for formatting text to a file in a multi-thread environment
;;
;; This code demonstrates that (gtk-main) function blocks
;; (all) other threads.
;; No idea why...

(use-modules (ice-9 threads))
(use-modules (gnome gtk))

(define (async-task2)
  (let ((file (open-output-file "test.txt")))
    (display "mmm\n")
    (do ((i 0 (+ 1 i)))
    ((>= i 100))
      (display "writing a line\n")
      (simple-format file "hep ~A ~%" i))                              
         
    (close file)
    (display "done\n")))
     
(make-thread async-task2)

(display "before gtk-main\n")
(gtk-main)
(display "after\n")

; this to prove that guile without GTK doesn't prevent autonomous
threads to execute.
;(do ((i 0 (+ 1 i)))
;    ((>= i 100))
;  (display "looping...\n")
;  (sleep 1))


_______________________________________________
Guile-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to