summaryrefslogtreecommitdiff
path: root/lib/igt_dummyload.c
diff options
context:
space:
mode:
authorAbdiel Janulgue <abdiel.janulgue@linux.intel.com>2016-12-01 12:36:53 +0200
committerAbdiel Janulgue <abdiel.janulgue@linux.intel.com>2016-12-01 13:37:55 +0200
commit1c7a50a07b9978fc6add73fec797979d9cf121f8 (patch)
tree415f786b5472c0ae967b4b5189c04f89153f57ca /lib/igt_dummyload.c
parentdc3fcd99e96f6714b5bd4614d8aeb113816d7ba9 (diff)
igt_dummyload: clear signal handler on the desructor as well
Fixes an issue when calling igt_spin_batch_set_timeout and then tearing down the spinner right away before it has the chance to timeout, causes the associated signal handler to linger. Make sure to remove the handler on the destructor. Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_dummyload.c')
-rw-r--r--lib/igt_dummyload.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 99515ea6..7ad09814 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -169,9 +169,17 @@ igt_spin_batch_new(int fd, int engine, unsigned int dep_handle)
return spin;
}
-static void sig_handler(int sig, siginfo_t *info, void *arg)
+static void clear_sig_handler(int sig)
{
struct sigaction act;
+
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = SIG_DFL;
+ igt_assert(sigaction(sig, &act, NULL) == 0);
+}
+
+static void sig_handler(int sig, siginfo_t *info, void *arg)
+{
struct igt_spin *iter;
igt_list_for_each(iter, &spin_list, link) {
@@ -181,9 +189,7 @@ static void sig_handler(int sig, siginfo_t *info, void *arg)
}
}
- memset(&act, 0, sizeof(act));
- act.sa_handler = SIG_DFL;
- igt_assert(sigaction(info->si_signo, &act, NULL) == 0);
+ clear_sig_handler(info->si_signo);
}
/**
@@ -248,6 +254,8 @@ void igt_spin_batch_end(igt_spin_t *spin)
*spin->batch = MI_BATCH_BUFFER_END;
__sync_synchronize();
+
+ clear_sig_handler(spin->signo);
}
/**