summaryrefslogtreecommitdiffstats
path: root/lib/libkse/thread/thr_suspend_np.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libkse/thread/thr_suspend_np.c')
-rw-r--r--lib/libkse/thread/thr_suspend_np.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libkse/thread/thr_suspend_np.c b/lib/libkse/thread/thr_suspend_np.c
index 871683a..6a6eaf4 100644
--- a/lib/libkse/thread/thr_suspend_np.c
+++ b/lib/libkse/thread/thr_suspend_np.c
@@ -51,8 +51,21 @@ pthread_suspend_np(pthread_t thread)
thread->interrupted = 1;
}
+ /*
+ * Guard against preemption by a scheduling signal.
+ * A change of thread state modifies the waiting
+ * and priority queues.
+ */
+ _thread_kern_sched_defer();
+
/* Suspend the thread. */
PTHREAD_NEW_STATE(thread,PS_SUSPENDED);
+
+ /*
+ * Reenable preemption and yield if a scheduling signal
+ * occurred while in the critical region.
+ */
+ _thread_kern_sched_undefer();
}
return(ret);
}
OpenPOWER on IntegriCloud