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

Re: Functions that start Jobs

On Jun 29, 11:16am, Sven Wischnowsky wrote:
} Subject: Re: Functions that start Jobs
} Vincent Lefevre wrote:
} > What happens if Ctrl-Z is typed while a builtin
} > is being executed?
} (Very good. ;-) That won't work because we need something to find out
} that something got suspended.  Some time ago we were discussing if it
} was possible to make this work, too.  I don't remember exactly, but
} nothing came of it.

It'd be pretty messy.  We'd either have to fork() in a signal handler
(which I'm sure is not a good idea), or else set a flag for TSTP the way
zsh presently does for INT -- and then at every point where we check the
INT'd flag, also check the TSTP'd flag and fork(), with the child then
STOPping itself and the parent breaking out as if INT'd.

Or we could use pthreads and put every command that's executed in the
current shell into its own thread.  But without a massive rewrite, we'd
have to make sure that no more than one thread at a time (including the
"parent" one) was ever executing -- so either it would not be possible
to put a stopped builtin in the background, or we'd still have to fork()
and continue only one thread in each process, and I'm really not sure if
that works any better than forking in a signal handler.

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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