Commits

Armin Rigo committed 983af03

Move 'd->active = 0' a bit earlier. This should be enough to ensure the new comment.

Comments (0)

Files changed (2)

   stm_thread_local_obj = d->old_thread_local_obj;
   d->old_thread_local_obj = NULL;
 
+  // notifies the CPU that we're potentially in a spin loop
+  SpinLoop(SPLP_ABORT);
+
+  /* make the transaction no longer active */
+  d->active = 0;
+  d->atomic = 0;
+
   /* release the lock */
   spinlock_release(d->public_descriptor->collection_lock);
 
   if (num != ABRT_MANUAL && d->max_aborts >= 0 && !d->max_aborts--)
     stm_fatalerror("unexpected abort!\n");
 
-  // notifies the CPU that we're potentially in a spin loop
-  SpinLoop(SPLP_ABORT);
   // jump back to the setjmp_buf (this call does not return)
-  d->active = 0;
-  d->atomic = 0;
   stm_stop_sharedlock();
   longjmp(*d->setjmp_buf, 1);
 }
 void stm_invoke_callbacks_on_abort(struct tx_descriptor *d)
 {
     wlog_t *item;
+    assert(d->active == 0);
+
     G2L_LOOP_FORWARD(d->callbacks_on_abort, item) {
         void *key = (void *)item->addr;
         void (*callback)(void *) = (void(*)(void *))item->val;
         assert(key != NULL);
         assert(callback != NULL);
 
+        /* The callback may call stm_call_on_abort(key, NULL).
+           It is ignored, because we're no longer active. */
         callback(key);
 
     } G2L_LOOP_END;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.