zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Why sourcing a file is not faster than doing a loop with eval, zle -N
Date: Mon, 19 Jun 2017 08:31:16 -0700	[thread overview]
Message-ID: <170619083116.ZM17323@torch.brasslantern.com> (raw)
In-Reply-To: <20170619122413.GA9294@chaz.gmail.com>

On Jun 19,  1:24pm, Stephane Chazelas wrote:
}
} There's probably scope for optimisation here, though I can't
} comment further as I don't know why that signal handling code is
} there in the first place.

rt_signprocmask should not be significantly more expensive than an
assignment to an integer.

The signal handling code is there because the shell MUST NOT respond
instantly to arbitrary signals while doing operations such as token
interpretation or or memory management -- the signal handlers might
themselves invoke shell commands/functions and many of those layers
are not safe for re-entrancy -- but it MUST respond to those signals 
whenever it may be blocked for an unknown length of time, such as when
reading from a file descriptor.

Many years of "I can't interrupt my script when X" or "interrupting
my script when Y causes a crash" resulted in the current signal
paradigm.  When the shell was first written, processors weren't fast
enough and process scheduling not well-threaded enough to expose a
lot of these issues, but the better our computers get the greater
the likelyhood of hitting an ever-smaller race condition window, so
those windows have to be aggressively closed.


  reply	other threads:[~2017-06-19 15:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <etPan.594513a8.516100cd.10b2e__10513.1716504276$1497699329$gmane$org@zdharma.org>
2017-06-19 12:24 ` Stephane Chazelas
2017-06-19 15:31   ` Bart Schaefer [this message]
     [not found]   ` <170619083116.ZM17323__41722.0601499595$1497886320$gmane$org@torch.brasslantern.com>
2017-06-19 16:16     ` Stephane Chazelas
2017-06-19 19:14       ` Bart Schaefer
2017-06-17 11:34 Sebastian Gniazdowski
     [not found] ` <CAH+w=7bVXtubcdwvEBC9isE32683dUipAUS=vrAkgO5pp2bkkw@mail.gmail.com>
     [not found]   ` <CAH+w=7afTi=1bfLBCmq8-vB-rLWDtEkAtk8gCCna3-mQwZ1-Ow@mail.gmail.com>
2017-06-17 14:05     ` Bart Schaefer
     [not found]     ` <etPan.594538f9.2ea629d6.10b2e@AirmailxGenerated.am>
2017-06-17 14:56       ` Sebastian Gniazdowski
2017-06-17 15:44         ` Sebastian Gniazdowski
2017-06-17 16:39           ` Bart Schaefer
2017-06-17 17:25             ` Sebastian Gniazdowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=170619083116.ZM17323@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).