Re : [Chicken-users] writing from a thread issue

2007-01-12 Thread minh thu

2007/1/12, felix winkelmann <[EMAIL PROTECTED]>:

On 1/12/07, minh thu <[EMAIL PROTECTED]> wrote:
>
> (define (poll-for-event)
>   (define (poll) ((write "in poll-for-event") ; not shown

That line above has a "(" to much. The arguments become
evaluated, but before the write is executed, the call to "poll"
is. The write is in operator position and might be executed
after the "(poll)".

Just remove the parens around the forms in "poll".


cheers,
felix


Oh thanks, I've looked at something like this but didn't find (so stupid).
And sorry too,

thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] writing from a thread issue

2007-01-12 Thread felix winkelmann

On 1/12/07, minh thu <[EMAIL PROTECTED]> wrote:


(define (poll-for-event)
  (define (poll) ((write "in poll-for-event") ; not shown


That line above has a "(" to much. The arguments become
evaluated, but before the write is executed, the call to "poll"
is. The write is in operator position and might be executed
after the "(poll)".

Just remove the parens around the forms in "poll".


cheers,
felix



  (newline)  ; shown
  (flush-output) ; changes nothing
  (thread-sleep! 1)
  (poll)))
  (poll))




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] writing from a thread issue

2007-01-12 Thread minh thu

Hi,

I made a script of my session to exhibit the problem:
No output is given by the thread but the blank lines.

Thanks for any help,
thu

Follows the output of my session (in a console in linux).

$ cat weird.scm
;;; weird.scm
;;
;; 12.01.2007
;;
;; Exhibits non-writing from a thread.
;;

(declare (uses srfi-18))

(define (poll-for-event)
 (define (poll) ((write "in poll-for-event") ; not shown
  (newline)  ; shown
  (flush-output) ; changes nothing
  (thread-sleep! 1)
  (poll)))
 (poll))

(define (go)
 (thread-start! poll-for-event))
$ csc -s weird.scm
$ csi -require-extension weird
)   ___
(__/_) /)   ,/)
 /   (/  _ (/_   _ __
// )__(_(__/(___(/_/ (_
(__)
Version 2, Build 3 - linux-unix-gnu-x86 - [ dload ptables ]
(c)2000-2005 Felix L. Winkelmann
; loading ./weird.so ...
#;1> (go)
#
#;2>






$ # I've done a ctrl-c. Notice the blank lines after #;2>


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users