Hi,
I have a strange problem with input/output and threads using GambitC-4b22 (WinXP/MINGW). I tried to isolate it.
It can be basically reproduced by running the following code in the interpreter:
(define (main)
(let ((t (make-thread
(lambda ()
(display "\n\n\n hello world!\n\n\n")
(force-output)))))
(thread-start! t)))
(main)
Which does the expected thing: display the "hello world" message in the console.
If I compile the above program to an executable it doesn't display the message anymore.
In my real context, I am using a mutex and many threads are writing a trace to the console. In the compiled version I get no traces...
What am I missing?
Thank you,
Francois Magnan
Afficher les réponses par date
Hi,
Sorry, for the last question! I solved it just after posting. In the compiled version of the code I sent the process terminated before the thread got a chance to execute the display... I added a (thread- sleep! 1) at the end and I saw the message appear.
I will look further in my code to see why I am not getting the expected outputs in the console from my threads...
Francois Magnan
On 07-04-23, at 12:27, Francois Magnan wrote:
Hi,
I have a strange problem with input/output and threads using GambitC-4b22 (WinXP/MINGW). I tried to isolate it.
It can be basically reproduced by running the following code in the interpreter:
(define (main)
(let ((t (make-thread
(lambda () (display "\n\n\n hello world!\n\n\n") (force-output))))) (thread-start! t)))
(main)
Which does the expected thing: display the “hello world” message in the console.
If I compile the above program to an executable it doesn’t display the message anymore.
In my real context, I am using a mutex and many threads are writing a trace to the console. In the compiled version I get no traces…
What am I missing?
Thank you,
Francois Magnan
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Hi,
Sorry, for the last question! I solved it just after posting. In the compiled version of the code I sent the process terminated before the thread got a chance to execute the display... I added a (thread-sleep! 1) at the end and I saw the message appear.
I will look further in my code to see why I am not getting the expected outputs in the console from my threads...
Francois Magnan
________________________________
From: gambit-list-bounces@iro.umontreal.ca [mailto:gambit-list-bounces@iro.umontreal.ca] On Behalf Of Francois Magnan Sent: Monday, April 23, 2007 12:27 PM To: gambit-list@iro.umontreal.ca Subject: [gambit-list] IO and threads question
Hi,
I have a strange problem with input/output and threads using GambitC-4b22 (WinXP/MINGW). I tried to isolate it.
It can be basically reproduced by running the following code in the interpreter:
(define (main)
(let ((t (make-thread
(lambda ()
(display "\n\n\n hello world!\n\n\n")
(force-output)))))
(thread-start! t)))
(main)
Which does the expected thing: display the "hello world" message in the console.
If I compile the above program to an executable it doesn't display the message anymore.
In my real context, I am using a mutex and many threads are writing a trace to the console. In the compiled version I get no traces...
What am I missing?
Thank you,
Francois Magnan