  
  /** @brief Decide whether to declare certain variables volatile. */
  #define _GLIBCXX_VOLATILE volatile
-@@ -76,7 +77,9 @@
+@@ -76,7 +77,11 @@
        _DifferenceType __chunk_size = __s.partition_chunk_size;
  
        omp_lock_t __result_lock;
++      soba_init(0, __num_threads, __num_threads*20);
++      soba_init(1, __num_threads, __num_threads*20);
 +      pcs_enter();
        omp_init_lock(&__result_lock);
 +      pcs_exit();
  
        //at least two chunks per thread
        if (__right - __left + 1 >= 2 * __num_threads * __chunk_size)
-@@ -87,6 +90,8 @@
- 	    __num_threads = omp_get_num_threads();
- 	    __reserved_left = new bool[__num_threads];
- 	    __reserved_right = new bool[__num_threads];
-+		soba_init(0, __num_threads, __num_threads*20);
-+		soba_init(1, __num_threads, __num_threads*20);
- 
- 	    if (__s.partition_chunk_share > 0.0)
- 	      __chunk_size = std::max<_DifferenceType>
 @@ -121,6 +126,8 @@
  	      __thread_left_border = __thread_left - 1;
  	      __thread_right = __n - 1;

--- gcc-4.5.4-orig/libstdc++-v3/include/parallel/partition.h	2012-12-26 01:03:55.995889274 -0500
+++ gcc-4.5.4/libstdc++-v3/include/parallel/partition.h	2013-03-16 16:48:42.606325029 -0400
@@ -38,6 +38,7 @@
 #include <parallel/random_number.h>
 #include <bits/stl_algo.h>

 
 	      // Now swap the leftover chunks to the right places.
 	      if (__thread_left <= __thread_left_border)
@@ -313,7 +323,11 @@
 	delete[] __reserved_left;
 	delete[] __reserved_right;
 
+    soba_destroy(0);
+    soba_destroy(1);
+    pcs_enter();
 	omp_destroy_lock(&__result_lock);
+    pcs_exit();
