1. Pypy
  2. Untitled project
  3. stmgc

Commits

Remi Meier  committed 14ac008

more asserts and a just-to-be-sure change that affects performance a bit

  • Participants
  • Parent commits 28f66a5
  • Branches default

Comments (0)

Files changed (1)

File c4/stmsync.c

View file
     d->max_aborts = max_aborts;
 }
 
+static void start_exclusivelock(void);
+static void stop_exclusivelock(void);
 int stm_enter_callback_call(void)
 {
     int token = (thread_descriptor == NULL);
     dprintf(("enter_callback_call(tok=%d)\n", token));
     if (token == 1) {
+        /* acquire exclusive lock. Just to be safe... 
+           XXX: remove again when sure it is not needed
+                (interaction with stop_all_other_threads()) */
+        start_exclusivelock();
         stmgcpage_acquire_global_lock();
 #ifdef STM_BARRIER_COUNT
         static int seen = 0;
         stmgc_init_nursery();
         init_shadowstack();
         stmgcpage_release_global_lock();
+        stop_exclusivelock();
     }
     BeginInevitableTransaction(0);
     return token;
     CommitTransaction(0);
 
     if (token == 1) {
+        start_exclusivelock();
         stmgcpage_acquire_global_lock();
         done_shadowstack();
         stmgc_done_nursery();
         DescriptorDone();
         stmgcpage_release_global_lock();
+        stop_exclusivelock();
     }
 }
 
 
 void stm_stop_sharedlock(void)
 {
+    assert(in_single_thread == NULL);
     dprintf(("stm_stop_sharedlock\n"));
     //assert(stmgc_nursery_hiding(thread_descriptor, 1));
     int err = pthread_rwlock_unlock(&rwlock_shared);
 
 static void stop_exclusivelock(void)
 {
+    assert(in_single_thread == NULL);
     dprintf(("stop_exclusivelock\n"));
     int err = pthread_rwlock_unlock(&rwlock_shared);
     if (err != 0)
 
     BecomeInevitable("stop_all_other_threads");
     if (!single_thread_nesting) {
+        assert(in_single_thread == NULL);
         stm_start_single_thread();
         
         for (d = stm_tx_head; d; d = d->tx_next) {