[rtems commit] score: Use proper protection

Sebastian Huber sebh at rtems.org
Mon Apr 7 14:42:12 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Apr  7 15:55:55 2014 +0200

score: Use proper protection

---

 cpukit/rtems/src/workspacegreedy.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/cpukit/rtems/src/workspacegreedy.c b/cpukit/rtems/src/workspacegreedy.c
index ad46df2..ecd4b86 100644
--- a/cpukit/rtems/src/workspacegreedy.c
+++ b/cpukit/rtems/src/workspacegreedy.c
@@ -24,6 +24,7 @@
 #endif
 
 #include <rtems/rtems/support.h>
+#include <rtems/score/apimutex.h>
 #include <rtems/score/heapimpl.h>
 #include <rtems/score/threaddispatch.h>
 #include <rtems/score/wkspace.h>
@@ -35,9 +36,9 @@ void *rtems_workspace_greedy_allocate(
 {
   void *opaque;
 
-  _Thread_Disable_dispatch();
+  _RTEMS_Lock_allocator();
   opaque = _Heap_Greedy_allocate( &_Workspace_Area, block_sizes, block_count );
-  _Thread_Enable_dispatch();
+  _RTEMS_Unlock_allocator();
 
   return opaque;
 }
@@ -48,19 +49,19 @@ void *rtems_workspace_greedy_allocate_all_except_largest(
 {
   void *opaque;
 
-  _Thread_Disable_dispatch();
+  _RTEMS_Lock_allocator();
   opaque = _Heap_Greedy_allocate_all_except_largest(
     &_Workspace_Area,
     allocatable_size
   );
-  _Thread_Enable_dispatch();
+  _RTEMS_Unlock_allocator();
 
   return opaque;
 }
 
 void rtems_workspace_greedy_free( void *opaque )
 {
-  _Thread_Disable_dispatch();
+  _RTEMS_Lock_allocator();
   _Heap_Greedy_free( &_Workspace_Area, opaque );
-  _Thread_Enable_dispatch();
+  _RTEMS_Unlock_allocator();
 }




More information about the vc mailing list