Author: Remi Meier <[email protected]>
Branch: stmgc-c8
Changeset: r83564:3d9408e5409c
Date: 2016-04-07 13:55 +0300
http://bitbucket.org/pypy/pypy/changeset/3d9408e5409c/

Log:    ignore signal if we are in the process of aborting a tx in this
        thread

diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h 
b/rpython/rlib/rvmprof/src/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/vmprof_main.h
@@ -146,26 +146,29 @@
         int fd = profile_file;
         assert(fd >= 0);
 
-        struct profbuf_s *p = reserve_buffer(fd);
-        if (p == NULL) {
-            /* ignore this signal: there are no free buffers right now */
+        vmprof_stack_t *stack = get_vmprof_stack();
+        /* for STM: check that we are not currently aborting this transaction: 
*/
+        if (stack != NULL) {
+            struct profbuf_s *p = reserve_buffer(fd);
+            if (p == NULL) {
+                /* ignore this signal: there are no free buffers right now */
+            }
+            else {
+                int depth;
+                struct prof_stacktrace_s *st = (struct prof_stacktrace_s 
*)p->data;
+                st->marker = MARKER_STACKTRACE;
+                st->count = 1;
+                depth = get_stack_trace(stack, st->stack,
+                                        MAX_STACK_DEPTH-2, 
GetPC((ucontext_t*)ucontext));
+                st->depth = depth;
+                st->stack[depth++] = get_current_thread_id();
+                p->data_offset = offsetof(struct prof_stacktrace_s, marker);
+                p->data_size = (depth * sizeof(void *) +
+                                sizeof(struct prof_stacktrace_s) -
+                                offsetof(struct prof_stacktrace_s, marker));
+                commit_buffer(fd, p);
+            }
         }
-        else {
-            int depth;
-            struct prof_stacktrace_s *st = (struct prof_stacktrace_s *)p->data;
-            st->marker = MARKER_STACKTRACE;
-            st->count = 1;
-            depth = get_stack_trace(get_vmprof_stack(), st->stack,
-                MAX_STACK_DEPTH-2, GetPC((ucontext_t*)ucontext));
-            st->depth = depth;
-            st->stack[depth++] = get_current_thread_id();
-            p->data_offset = offsetof(struct prof_stacktrace_s, marker);
-            p->data_size = (depth * sizeof(void *) +
-                            sizeof(struct prof_stacktrace_s) -
-                            offsetof(struct prof_stacktrace_s, marker));
-            commit_buffer(fd, p);
-        }
-
         errno = saved_errno;
     }
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to