unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Radford <radford@blackbean.org>
To: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: 18705@debbugs.gnu.org
Subject: bug#18705: 24.3.93; Hang in ns_select -> [NSApp run] -> oo
Date: Wed, 15 Oct 2014 11:52:46 -0700	[thread overview]
Message-ID: <20141015185245.GA27833@home.blackbean.org> (raw)
In-Reply-To: <F0B6063A-631A-4F06-84EE-47A7BFD8301B@swipnet.se>

On Wed, Oct 15, 2014 at 07:50:52PM +0200, Jan Djärv wrote:
> 13 okt 2014 kl. 09:13 skrev Jim Radford <radford@blackbean.org>:
> 
> > I often cannot connect to "emacs --daemon" with emacsclient because
> > instead of select()ing on the appropriate sockets it's stuck in [NSApp
> > run] waiting for an event which will never come.  Note at this time
> > there are no Cocoa windows open (I don't use them) so no events will
> > *ever* come (unless I, say, open and close the about box which triggers
> > an escape from the hang).  Here's the backtrace when this occurs.
> > 
> >    frame #9: 0x00007fff940cc89b AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
> >    frame #10: 0x00000001001a659f Emacs`-[EmacsApp run](self=0x0000000100a26910, _cmd=<unavailable>) + 223 at nsterm.m:4494
> >    frame #11: 0x00000001001a5219 Emacs`ns_select(nfds=<unavailable>, readfds=0x00007fff5fbfea00, writefds=0x00007fff5fbfe980, exceptfds=<unavailable>, timeout=<unavailable>, sigmask=<unavailable>) + 809 at nsterm.m:3748
> > 
> Cocoa does not allow you to disconnect and connect the GUI like X can.
> So running a Cocoa compiled Emacs as --daemon does not make much sense.
> You are seeing the consequence of this.

What doesn't make sense is running two main loops in the same thread
and trying to alternatively spin on one (EmacsApp run) and then the
other (select) without knowing which might produce the next event.
That is guaranteed to fail, as I am seeing.

I'm going to guess that you can't register file descriptors with the
Cocoa main loop nor get a file descriptor from it that you can pass to
select?  Could we instead spawn a thread just to run select() in a
loop, passing the results to the main thread as a Cocoa event?  Or
visa versa?

-Jim





  reply	other threads:[~2014-10-15 18:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13  7:13 bug#18705: 24.3.93; Hang in ns_select -> [NSApp run] -> oo Jim Radford
2014-10-15 17:50 ` Jan Djärv
2014-10-15 18:52   ` Jim Radford [this message]
2014-10-15 19:21   ` Stefan Monnier
2014-10-16  5:44     ` Jan Djärv
2015-05-17 15:38     ` Jan Djärv
     [not found]   ` <20141015185932.GA28148@home.blackbean.org>
     [not found]     ` <19878B19-176E-4345-A5F7-CC1E005C63B7@swipnet.se>
2014-10-16  5:36       ` Jan Djärv

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20141015185245.GA27833@home.blackbean.org \
    --to=radford@blackbean.org \
    --cc=18705@debbugs.gnu.org \
    --cc=jan.h.d@swipnet.se \
    /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.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).