+
+#if defined (SIGRTMIN) && defined (SIGRTMAX)
+ /*The runtime uses some rt signals for itself so it's important to not override them.*/
+ if (sig >= SIGRTMIN && sig <= SIGRTMAX && count_handlers (sig) == 0) {
+ struct sigaction sinfo;
+ sigaction (sig, NULL, &sinfo);
+ if (sinfo.sa_handler != SIG_DFL || (void*)sinfo.sa_sigaction != (void*)SIG_DFL) {
+ pthread_mutex_unlock (&signals_mutex);
+ errno = EADDRINUSE;
+ return NULL;
+ }