Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: coloring STDERR to terminal



On Fri, 2 Jul 2004, Vincent Lefevre wrote:

> Now, in precmd(), adding the following line solves the problem:
> 
>   sleep 0
> 
> Of course, this won't completely avoid the race condition, but it
> improves things in pratice. I assume that this forces the scheduler
> to switch to another process, and in practice, the coprocess is
> scheduled before precmd() is resumed.

As sleep is an external command rather than a builtin (cf. zselect), this 
forces zsh to perform a wait() system call [more or less], which in turn 
forces the scheduler to let the sleep run to completion before zsh wakes 
up again.  That it's specifically "sleep 0" is probably irrelevant; any 
external command is likely to have the same effect.



Messages sorted by: Reverse Date, Date, Thread, Author