From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] sup ignoring SIGTERM?
Date: Thu, 06 Aug 2009 10:53:43 -0700 [thread overview]
Message-ID: <1249581215-sup-2548@masanjin.net> (raw)
In-Reply-To: <1249507336-sup-7887@masanjin.net>
Reformatted excerpts from William Morgan's message of 2009-08-05:
> The problem is the removal of the select() in nonblocking_getch
> (buffer.rb circa line 25). With it in, resizes don't work right. With
> it removed, background threads are blocked on some computers. Not sure
> what makes the difference. Sigh...
Ok, I've tracked this down. FWIW, this is a problem that's been around
in ruby ncurses libraries since at least 2005, when I complained about
it on ruby-core.
In many ruby ncurses libraries, including the most recent gem,
Ncurses.getch blocks all Ruby threads from running. That's a bug. The
workaround is to wrap it in a select() call. But then you have to handle
sigwinch manually (i.e via Kernel#trap), because getch won't return a
resize "keystroke" until the user hits an actual key.
The libncurses-ruby library on modern Ubuntu systems actually doesn't
have this problem. You can set nodelay false, throw out the select call,
and everything works the way it's supposed to: background threads run,
and you get a resize keystroke when a sigwinch happens without you
having to install your own handler. And that's the library I had been
developing against, which is why everything worked on one computer but
didn't work on the others.
Anyways, for those who were having problems with this branch before,
please try the most recent version and confirm that:
1. Email threads load as normal, i.e. in the background.
2. Resizing the terminal refreshes the screen without you having to
press any keys.
3. Ctrl-l still works.
4. Ctrl-c still works (prompts you, and y/n do the right thing).
5. Killing Sup works.
If everyone's happy, I'll merge this branch into next.
If you're curious about whether you have a good or bad ncurses library,
run this program: (But either should work correctly with Sup.)
require 'rubygems'
require 'ncurses'
require 'thread'
Ncurses.initscr
Ncurses.noecho
Ncurses.cbreak
Ncurses.curs_set 0
Thread.new do
sleep 0.1
Ncurses.stdscr.mvaddstr 0, 0, "ncurses library is GOOD."
end
begin
Ncurses.stdscr.mvaddstr 0, 0, "ncurses library is BAD."
Ncurses.getch
ensure
Ncurses.curs_set 1
Ncurses.endwin
puts "bye"
end
--
William <wmorgan-sup at masanjin.net>
next prev parent reply other threads:[~2009-08-06 17:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-05 14:09 Adeodato Simó
2009-08-05 20:03 ` William Morgan
2009-08-05 20:25 ` Nicolas Pouillard
2009-08-05 21:24 ` William Morgan
2009-08-06 17:53 ` William Morgan [this message]
2009-08-06 18:09 ` Nicolas Pouillard
2009-08-06 23:56 ` Ben Walton
2009-08-05 20:35 ` Ben Walton
2009-08-05 21:28 ` Edward Z. Yang
2009-08-06 18:37 ` Adeodato Simó
2009-08-07 1:38 ` William Morgan
2009-08-07 10:31 ` Adeodato Simó
2009-08-07 16:40 ` Rich Lane
2009-08-08 9:23 ` Adeodato Simó
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=1249581215-sup-2548@masanjin.net \
--to=wmorgan-sup@masanjin.net \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox