summaryrefslogtreecommitdiffstats
path: root/lib/libc_r/uthread/uthread_yield.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc_r/uthread/uthread_yield.c')
-rw-r--r--lib/libc_r/uthread/uthread_yield.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/libc_r/uthread/uthread_yield.c b/lib/libc_r/uthread/uthread_yield.c
index 7d64283..67ca501 100644
--- a/lib/libc_r/uthread/uthread_yield.c
+++ b/lib/libc_r/uthread/uthread_yield.c
@@ -31,15 +31,19 @@
*
* $FreeBSD$
*/
-#ifdef _THREAD_SAFE
#include <pthread.h>
#include "pthread_private.h"
+#pragma weak sched_yield=_sched_yield
+#pragma weak pthread_yield=_pthread_yield
+
int
-sched_yield(void)
+_sched_yield(void)
{
+ struct pthread *curthread = _get_curthread();
+
/* Reset the accumulated time slice value for the current thread: */
- _thread_run->slice_usec = -1;
+ curthread->slice_usec = -1;
/* Schedule the next thread: */
_thread_kern_sched(NULL);
@@ -50,12 +54,13 @@ sched_yield(void)
/* Draft 4 yield */
void
-pthread_yield(void)
+_pthread_yield(void)
{
+ struct pthread *curthread = _get_curthread();
+
/* Reset the accumulated time slice value for the current thread: */
- _thread_run->slice_usec = -1;
+ curthread->slice_usec = -1;
/* Schedule the next thread: */
_thread_kern_sched(NULL);
}
-#endif
OpenPOWER on IntegriCloud