Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/4] lib: fix exit handler when multiple handlers are registered
Date: Wed, 22 May 2013 17:40:45 +0300	[thread overview]
Message-ID: <1369233648-5873-1-git-send-email-imre.deak@intel.com> (raw)

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 lib/drmtest.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 981ab4b..9fc03a0 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -1065,7 +1065,7 @@ static void call_exit_handlers(int sig)
 		return;
 	}
 
-	for (i = 0; i < exit_handler_count; i++)
+	for (i = exit_handler_count - 1; i >= 0; i--)
 		exit_handler_fn[i](sig);
 }
 
@@ -1111,6 +1111,9 @@ static int drmtest_install_exit_handler(drmtest_exit_handler_t fn)
 	exit_handler_fn[exit_handler_count] = fn;
 	exit_handler_count++;
 
+	if (exit_handler_count > 1)
+		return 0;
+
 	for (i = 0; i < ARRAY_SIZE(handled_signals); i++) {
 		if (install_sig_handler(handled_signals[i],
 					drmtest_sig_handler))
-- 
1.8.1.2

             reply	other threads:[~2013-05-22 14:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-22 14:40 Imre Deak [this message]
2013-05-22 14:40 ` [PATCH 2/4] lib: export the exit handler interface Imre Deak
2013-05-22 14:40 ` [PATCH 3/4] kms_flip: do a DPMS ON when exiting with error Imre Deak
2013-05-22 14:40 ` [PATCH 4/4] kms_flip: add subtests for the DPMS OFF->modeset->flip sequence Imre Deak
2013-05-22 16:18   ` Daniel Vetter

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=1369233648-5873-1-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox