chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Subprocess blocking all threads under certain circum


From: F. Wittenberger
Subject: Re: [Chicken-users] Subprocess blocking all threads under certain circumstances
Date: Wed, 14 Jul 2010 14:29:02 +0200

Am Mittwoch, den 14.07.2010, 13:23 +0200 schrieb Moritz Heidkamp: 
> Dear Chickeneers,
...
> And it works as advertised. However, if I close both the input and the
> output ports of the process, all other threads seem to be blocked. If I
> close none of them or only one of them, it works. The following silly
> program demonstrates this behavior:
> 
>   (use srfi-18 posix)
> 
>   (define start (current-seconds))
> 
>   (thread-start! (lambda ()
>                    (receive (in out pid)
>                      (process "sleep 5")
>                      (close-output-port out)
>                      (close-input-port in))))
> 
>   (thread-sleep! 1)
>   (print (- (current-seconds) start) " second(s) passed")

Without actually trying your example (but having read the corresponding
code in chicken's source before), I would say: it print 1 if you comment
out any of the close-*-port lines and 5 otherwise.

IMHO it's the best to document that the last close will implicitly wait
for the child process to exit.



reply via email to

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