From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] queueing_enabled grows infinitely when in .recursive-edit
Date: Mon, 3 Oct 2016 09:07:50 -0700 [thread overview]
Message-ID: <161003090750.ZM8137@torch.brasslantern.com> (raw)
In-Reply-To: <161003082029.ZM7267@torch.brasslantern.com>
On Oct 3, 8:20am, Bart Schaefer wrote:
}
} I will clean up that additional debugging for signals.h to make it
} suitable for commit, so that we have a better chance of catching these
} problems in new code.
Here is that.
diff --git a/Src/signals.c b/Src/signals.c
index e2587dc..9e05add 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -72,6 +72,10 @@ mod_export int queueing_enabled, queue_front, queue_rear;
mod_export int signal_queue[MAX_QUEUE_SIZE];
/**/
mod_export sigset_t signal_mask_queue[MAX_QUEUE_SIZE];
+#ifdef DEBUG
+/**/
+mod_export int queue_in;
+#endif
/* Variables used by trap queueing */
diff --git a/Src/signals.h b/Src/signals.h
index d680968..1904f43 100644
--- a/Src/signals.h
+++ b/Src/signals.h
@@ -82,8 +82,6 @@
#define MAX_QUEUE_SIZE 128
-#define queue_signals() (queueing_enabled++)
-
#define run_queued_signals() do { \
while (queue_front != queue_rear) { /* while signals in queue */ \
sigset_t oset; \
@@ -94,12 +92,35 @@
} \
} while (0)
+#ifdef DEBUG
+
+#define queue_signals() (queue_in++, queueing_enabled++)
+
#define unqueue_signals() do { \
DPUTS(!queueing_enabled, "BUG: unqueue_signals called but not queueing"); \
+ --queue_in; \
if (!--queueing_enabled) run_queued_signals(); \
} while (0)
-#define queue_signal_level() queueing_enabled
+#define dont_queue_signals() do { \
+ queue_in = queueing_enabled; \
+ queueing_enabled = 0; \
+ run_queued_signals(); \
+} while (0)
+
+#define restore_queue_signals(q) do { \
+ DPUTS2(queueing_enabled && queue_in != q, \
+ "BUG: q = %d != queue_in = %d", q, queue_in); \
+ queue_in = (queueing_enabled = (q)); \
+} while (0)
+
+#else /* !DEBUG */
+
+#define queue_signals() (queueing_enabled++)
+
+#define unqueue_signals() do { \
+ if (!--queueing_enabled) run_queued_signals(); \
+} while (0)
#define dont_queue_signals() do { \
queueing_enabled = 0; \
@@ -108,6 +129,10 @@
#define restore_queue_signals(q) (queueing_enabled = (q))
+#endif /* DEBUG */
+
+#define queue_signal_level() queueing_enabled
+
#ifdef BSD_SIGNALS
#define signal_block(S) sigblock(S)
#else
next prev parent reply other threads:[~2016-10-03 16:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-02 19:00 Sebastian Gniazdowski
2016-10-02 19:02 ` Sebastian Gniazdowski
2016-10-02 23:21 ` Bart Schaefer
2016-10-03 10:00 ` Sebastian Gniazdowski
2016-10-03 10:18 ` Peter Stephenson
2016-10-03 11:55 ` Sebastian Gniazdowski
2016-10-03 15:49 ` Bart Schaefer
2016-10-03 16:43 ` Sebastian Gniazdowski
2016-10-03 18:11 ` Bart Schaefer
2016-10-05 5:56 ` Sebastian Gniazdowski
2016-10-05 6:03 ` Sebastian Gniazdowski
2016-10-03 15:20 ` Bart Schaefer
2016-10-03 16:07 ` Bart Schaefer [this message]
2016-10-03 16:33 ` Bart Schaefer
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=161003090750.ZM8137@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).