From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Asynchronous DNS Date: Wed, 03 Feb 2016 17:49:23 +0200 Message-ID: <83k2mlyet8.fsf@gnu.org> References: <87si1gx6wz.fsf@gnus.org> <86y4b5zvzt.fsf@gmail.com> <8760y9kwrk.fsf@gnus.org> <87wpqpjgwy.fsf@gnus.org> <83a8nk1cxk.fsf@gnu.org> <87h9hrnc8x.fsf@gnus.org> <83powfzsqt.fsf@gnu.org> <87y4b393hl.fsf@gnus.org> <83io27ytu3.fsf@gnu.org> <87k2mmzkry.fsf@gnus.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1454514722 26557 80.91.229.3 (3 Feb 2016 15:52:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Feb 2016 15:52:02 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 03 16:52:02 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aQzio-0007Zx-2c for ged-emacs-devel@m.gmane.org; Wed, 03 Feb 2016 16:51:58 +0100 Original-Received: from localhost ([::1]:35759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQzin-0007JR-J4 for ged-emacs-devel@m.gmane.org; Wed, 03 Feb 2016 10:51:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQzgg-0003vt-9s for emacs-devel@gnu.org; Wed, 03 Feb 2016 10:49:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQzgb-0003B5-9o for emacs-devel@gnu.org; Wed, 03 Feb 2016 10:49:46 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQzgb-0003B1-6n; Wed, 03 Feb 2016 10:49:41 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3074 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aQzga-0005yn-K3; Wed, 03 Feb 2016 10:49:40 -0500 In-reply-to: <87k2mmzkry.fsf@gnus.org> (message from Lars Ingebrigtsen on Wed, 03 Feb 2016 11:42:57 +1100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:199240 Archived-At: > From: Lars Ingebrigtsen > Cc: emacs-devel@gnu.org > Date: Wed, 03 Feb 2016 11:42:57 +1100 > > > We need to know which code can run on a separate thread, because some > > things cannot be safely done from any thread but the main > > (a.k.a. "Lisp") thread. Running the Lisp interpreter is one of them, > > but it's not the only one. You cannot QUIT or signal an error or do > > anything else that throws to top-level. You cannot call malloc or > > free, or any code that does. You cannot modify any data structures > > visible from Lisp, like buffers, Lisp strings, and the undo list. You > > cannot access or modify global variables or call any non-reentrant > > Emacs functions. And there are other no-no's, these are just a few > > that popped in my mind within the first 5 sec. > > Except the malloc thing, that just boils down to "you can't do anything > Lispy on the other threads" I think? I don't think "anything Lispy" is a useful definition, since almost everything we do in Emacs on the C level is "Lispy" in some way. And a C programmer won't see too many "Lispy" things, I think. E.g., QUIT just calls longjmp, a standard C function. Many functions that have potentially long loops call QUIT inside the loop, and you cannot call those in a non-main thread. Assigning values to a global variable is standard C practice, but there are some (quite a few, actually) variables in Emacs which cannot be safely assigned from a non-main thread, unless you introduce some synchronization mechanism. > Which nobody has proposed, anyway. I was just explaining why knowing that we are starting application threads, and knowing what code these threads can run, is important. > > However, it sounds like this is all much ado about nothing: I see no > > references to any threads, old or new, in the changes you made on your > > feature branch, so is there really anything to discuss here? (I asked > > the question which led to this sub-thread because you mentioned that > > you "start a new thread that does getaddrinfo".) > > No, I wrote that that's what getaddrinfo_a does, so we could just do > that ourselves and not have to rely on getaddrinfo_a. If we introduce such a thread, its code needs to be carefully audited for the above-mentioned gotchas. E.g., passing to it a C pointer to a contents of a Lisp string is probably unsafe. It's not rocket science to DTRT in this case (we already do that quite a lot on MS-Windows), it just requires very careful programming and code review. > >> Anyway, this reminds me of something that I've been wondering about gdb > >> output when running Emacs. It often says something like this: > >> > >> warning: Corrupted shared library list: 0x84582e0 != 0x5104c30 > >> warning: Corrupted shared library list: 0x2f172a0 != 0x21688a0 > >> warning: Corrupted shared library list: 0x79f1910 != 0x21688a0 > >> warning: Corrupted shared library list: 0x79f1910 != 0x21688a0 > >> warning: Corrupted shared library list: 0x7a07ae0 != 0x21688a0 > >> > >> Is that something to be worried about, or is it... normal? > > > > It's a real problem. Crystal ball says that some of the system > > libraries Emacs uses don't have debug info files to match them; > > instead, you have debug info files from different versions of the > > libraries. Try "info sharedlibrary" at the GDB prompt, maybe it will > > tell you which libraries are the offending ones. > > Ok, but it's a problem when debugging in gdb, and not a problem for an > Emacs running without gdb? Only for the former, AFAIK. GDB is complaining about a data structure it builds, not about something the executable does.