[rtems commit] posix: Avoid Giant lock in sched_yield()

Sebastian Huber sebh at rtems.org
Thu Mar 17 08:03:20 UTC 2016


Module:    rtems
Branch:    master
Commit:    75aef54d16baab507134a5011e955151b990dcf6
Changeset: http://git.rtems.org/rtems/commit/?id=75aef54d16baab507134a5011e955151b990dcf6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Mar 17 06:16:23 2016 +0100

posix: Avoid Giant lock in sched_yield()

Update #2555.

---

 cpukit/posix/src/sched_yield.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/cpukit/posix/src/sched_yield.c b/cpukit/posix/src/sched_yield.c
index e398fbf..7e056ce 100644
--- a/cpukit/posix/src/sched_yield.c
+++ b/cpukit/posix/src/sched_yield.c
@@ -26,8 +26,10 @@
 
 int sched_yield( void )
 {
-  _Thread_Disable_dispatch();
-    _Thread_Yield( _Thread_Executing );
-  _Thread_Enable_dispatch();
+  Per_CPU_Control *cpu_self;
+
+  cpu_self = _Thread_Dispatch_disable();
+    _Thread_Yield( _Per_CPU_Get_executing( cpu_self ) );
+  _Thread_Dispatch_enable( cpu_self );
   return 0;
 }



More information about the vc mailing list