From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: block_input for some APIs Date: Tue, 13 Dec 2016 09:13:40 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <831sxdc9hs.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1481588067 12282 195.159.176.226 (13 Dec 2016 00:14:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Dec 2016 00:14:27 +0000 (UTC) User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 13 01:14:24 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGajc-000270-B6 for ged-emacs-devel@m.gmane.org; Tue, 13 Dec 2016 01:14:20 +0100 Original-Received: from localhost ([::1]:34479 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGajg-0004j4-5o for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 19:14:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGaj6-0004im-Md for emacs-devel@gnu.org; Mon, 12 Dec 2016 19:13:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGaj3-0002Tc-HQ for emacs-devel@gnu.org; Mon, 12 Dec 2016 19:13:48 -0500 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:60521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGaj3-0002TH-8b for emacs-devel@gnu.org; Mon, 12 Dec 2016 19:13:45 -0500 Original-Received: from fermat1.math.s.chiba-u.ac.jp (fermat [192.168.32.10]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id BF0B2F39FD for ; Tue, 13 Dec 2016 09:13:40 +0900 (JST) (envelope-from mituharu@math.s.chiba-u.ac.jp) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 133.82.132.2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210387 Archived-At: >>>>> On Mon, 12 Dec 2016 16:48:53 -0500, Stefan Monnier said: >>> Does anyone remember why we block input around calls to functions like >>> getpwnam or tzset or fwrite? >> I think this dates back to when C-g and/or other handlers called >> longjmp. > I'm not completely sure, but my own impression is that this dates back > to before SYNC_INPUT, i.e. with input became available, we'd get an IO > signal and in the handler we'd run a whole bunch of code, since > reentrance was a big issue. Nowadays we delay this async processing to > the next QUIT so there's no re-entrance issue any more. I added some of them around early 2007, when SYNC_INPUT was not used by default. These functions call malloc etc. internally (at least on Darwin), so it was not safe to call read_socket_hook, which also calls malloc etc., from SIGIO/SIGALRM handler while processing getpwnam etc. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp