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

Re: multi threaded script



2009/11/3 Joke de Buhr <joke.de.buhr@xxxxxxxxx>:
> On Tuesday 03 November 2009 17:34:57 Baptiste Daroussin wrote:
>> Hi,
>>
>> I wanted to write a script that needs to be multithreaded, for example
>> an UI in zsh/curses that does things in background while the UI is
>> still responsive.
>
> It's possible to do background tasks in subshells. Simple append an & to
> the end of the subshell list:
>
>  print "hi_0"; { print "hi_1"; sleep 60; print "hi_2"} & print "hi_3"; \
>     sleep 20; print "hi_4"
>
>
> Somewhere on the internet there is an example in bash of how to setup a
> multiprocess shell program which uses subshells as worker processes. The
> communication between these processes is done via named pipes. It's much
> like Apache's worker process model.

http://lwn.net/Articles/309682/

-- 
Mikael Magnusson



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