pthread_kill (p->pthread, SIGUSR2);
}
+static volatile processor_t *next_timer = NULL;
+static pthread_mutex_t nt_mutex = MUTEX_INITIALIZER;
+#ifdef ENABLE_DEBUGGING_TOOLS
+# define LOCK_NT() do \
+{ \
+ int err = pthread_mutex_lock (&nt_mutex); \
+ assert (err == 0); \
+} while (false)
+# define UNLOCK_NT() do \
+{ \
+ int err = pthread_mutex_unlock (&nt_mutex); \
+ assert (err == 0); \
+} while (false)
+#else
+# define LOCK_NT() do \
+{ \
+ int err = pthread_mutex_lock (&nt_mutex); \
+ if (err) \
+ error_with_argument (err); \
+} while (false)
+# define UNLOCK_NT() do \
+{ \
+ int err = pthread_mutex_unlock (&nt_mutex); \
+ if (err) \
+ error_with_argument (err); \
+} while (false)
+#endif
+
void
smp_kill_timer (processor_t *p)
{
+ block_signals ();
+ LOCK_NT();
+ next_timer = p;
pthread_kill (p->pthread, SIGALRM);
+ UNLOCK_NT();
+ unblock_signals ();
+}
+
+void
+smp_timer_interrupt (void)
+{
+ volatile processor_t *p;
+
+ LOCK_NT();
+ p = next_timer;
+ if (p == NULL)
+ p = processors;
+ if (p == self)
+ {
+ request_timer_interrupt ();
+ next_timer = p->next;
+ }
+ else
+ pthread_kill (p->pthread, SIGALRM);
+ UNLOCK_NT();
}
#endif /* ENABLE_SMP */
static
DEFUN_STD_HANDLER (sighnd_timer,
{
+#ifndef ENABLE_SMP
request_timer_interrupt ();
+#else
+ smp_timer_interrupt ();
+#endif
})
#else /* not HAVE_SETITIMER */
DEFUN_STD_HANDLER (sighnd_timer,
{
reschedule_alarm ();
+#ifndef ENABLE_SMP
request_timer_interrupt ();
+#else
+ smp_timer_interrupt ();
+#endif
})
#endif /* not HAVE_SETITIMER */