[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange threading behaviour in guile-16.1 (--with-threads) and (gtk-main

From: Stanislas Pinte
Subject: Strange threading behaviour in guile-16.1 (--with-threads) and (gtk-main): gtk-main blocks all other threads
Date: Fri, 09 Feb 2007 10:55:04 +0100
User-agent: Thunderbird (Windows/20061207)


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,


;;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")
(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))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]