Rewrite the POSIX timer functions.

This is a much simpler implementation that lets the kernel
do as much as possible.

Co-authored-by: Jörgen Strand <jorgen.strand@sonymobile.com>
Co-authored-by: Snild Dolkow <snild.dolkow@sonymobile.com>
Change-Id: Iad19f155de977667aea09410266d54e63e8a26bf
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 120bbc7..1e85a54 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -25,6 +25,8 @@
 #include <time.h>
 #include <unistd.h>
 
+#include "ScopedSignalHandler.h"
+
 TEST(pthread, pthread_key_create) {
   pthread_key_t key;
   ASSERT_EQ(0, pthread_key_create(&key, NULL));
@@ -337,14 +339,8 @@
 }
 
 TEST(pthread, pthread_kill__in_signal_handler) {
-  struct sigaction action;
-  struct sigaction original_action;
-  sigemptyset(&action.sa_mask);
-  action.sa_flags = 0;
-  action.sa_handler = pthread_kill__in_signal_handler_helper;
-  ASSERT_EQ(0, sigaction(SIGALRM, &action, &original_action));
+  ScopedSignalHandler ssh(SIGALRM, pthread_kill__in_signal_handler_helper);
   ASSERT_EQ(0, pthread_kill(pthread_self(), SIGALRM));
-  ASSERT_EQ(0, sigaction(SIGALRM, &original_action, NULL));
 }
 
 TEST(pthread, pthread_detach__no_such_thread) {