pth_detached3 \
pth_inconsistent_cond_wait \
pth_mutex_reinit \
+ pth_mutex_signal \
pth_process_shared_mutex \
recursive_mutex \
rwlock_race \
check_PROGRAMS += pth_create_glibc_2_0
endif
-if !VGCONF_OS_IS_DARWIN
-check_PROGRAMS += pth_mutex_signal
-endif
-
if HAVE_PTHREAD_SPINLOCK
check_PROGRAMS += pth_spinlock
endif
/*
+ * Verify that pthread_mutex_lock() is not interrupted by a signal.
+ *
* See also https://bugs.kde.org/show_bug.cgi?id=445743.
*/
#include <unistd.h>
#define STACK_SIZE 1024 * 512
-#define NATIVE_IO_INTERRUPT_SIGNAL (SIGRTMAX - 2)
#define LONG_SLEEP_TIME 1000000
void *contender_start(void *arg)
signalAction.sa_sigaction = nullHandler;
sigfillset(&signalAction.sa_mask);
signalAction.sa_flags = 0;
- sigaction(NATIVE_IO_INTERRUPT_SIGNAL, &signalAction, NULL);
+ sigaction(SIGINT, &signalAction, NULL);
// initialize the mutex
pthread_mutexattr_init(&mutex_attr);
}
fprintf(stderr, "thread created\n");
pthread_attr_destroy(&thread_attr_contender);
-
+
+ // Block signals in the current thread such that signals are delivered to the
+ // 'contender' thread.
+ {
+ sigset_t mask;
+ sigfillset(&mask);
+ pthread_sigmask(SIG_BLOCK, &mask, NULL);
+ }
+
// wait until the thread is sleeping inside pthread_mutex_lock().
fprintf(stderr, "sleeping\n");
usleep(LONG_SLEEP_TIME);
// signal thread
fprintf(stderr, "signalling\n");
- pthread_kill(contender, NATIVE_IO_INTERRUPT_SIGNAL);
+ pthread_kill(contender, SIGINT);
fprintf(stderr, "sleeping\n");
usleep(LONG_SLEEP_TIME);