top: immunize against window manager flood of SIGWINCH
Whew, it was nip-and-tuck there for awhile but finally we solved the SIGWINCH overload problem one finds with most X window managers. Now if a window manager should try to inundate ol' top with repeated SIGWINCH signals they won't even be received so can't impact us at all. And we achieve this miracle having never even issued a sigprocmask, so all the top code executes with signals totally unblocked. Intuition suggests it probably rubs even more salt in the wound, but au contraire mon ami! The key to our success was simply trading the 'select' call for its cousin 'pselect'. Not only does that call provide nanosecond granularity (vs. the former's usec) but it takes a sigset_t parm which can then atomically block the troublesome SIGWINCH guy until user input or optional timeout. Net result? No more signal overload! Now, if only we could just coax all terminal emulators into one identical standard buffering scheme plus find some way to emulate the most recent SIGWINCH, it would be perfect. We would then obviate the user requirement of typing yet 1 more key before seeing proper results. (everything is perfectly justified plus right margins) (are completely filled, but of course it must be luck) Reference(s): http://www.freelists.org/post/procps/unwanted-topinspect-window-enclosure-with-the-terminal-size-change http://www.freelists.org/post/procps/Sourceforge-project,7 Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@ -630,7 +630,7 @@ typedef struct WIN_t {
|
||||
/*------ Low Level Memory/Keyboard/File I/O support --------------------*/
|
||||
//atic void *alloc_c (size_t num);
|
||||
//atic void *alloc_r (void *ptr, size_t num);
|
||||
//atic inline int ioa (struct timeval *tv);
|
||||
//atic inline int ioa (struct timespec *ts);
|
||||
//atic int ioch (int ech, char *buf, unsigned cnt);
|
||||
//atic int iokey (int init);
|
||||
//atic char *ioline (const char *prompt);
|
||||
|
Reference in New Issue
Block a user