[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Problem with threads
From: |
F. Wittenberger |
Subject: |
Re: [Chicken-users] Problem with threads |
Date: |
Fri, 19 Nov 2010 22:14:39 +0100 |
Am Freitag, den 19.11.2010, 15:10 -0200 schrieb Jeronimo Pellegrini:
> Hello,
>
> I'm using Chicken from git/master branch (commit
> ddaacdfdb11a0a1c0d1e6363b1af3af78746575c).
>
> I recently noticed a change in the behavior of Chicken's
> scheduler. See this program:
>
> (use srfi-18)
>
> (define looping-thread
> (let ((loop (lambda () (do ((i 0 (add1 i)))
> (#f)
> (print ':: i)))))
> (thread-start! (make-thread loop))))
I'm NOT at all sure, that my following observation/assumption is correct
and applicable in your case.
But I ran into a similar situation last night and eventually found out
that this might more be related to port handling:
(Let me add: I have a LOT of asynch i/o going on from different threads
and just today managed to overcome some problem with my recent chicken
upgrade - that's where the "last night" comes from. Everything works
fine even though I ignored my following observation):
Writes on (standard-output-port) from *different* threads appear to
share end-of-line-states in a different way that before.
And...
That's very much just OK until there is a defined behaviour wrt.
atomicity for each operation on the port. (Which would be strange in
case of a complex thing like "print".)
So in this case I'd add a (flush-output (standard-output-port)) whenever
you want to actually see the current state. (That's what you've should
have been done before as well, just to be sure.)