Author: Armin Rigo <ar...@tunes.org>
Branch: vmprof-review
Changeset: r78757:1cf561fab385
Date: 2015-08-04 11:39 +0200
http://bitbucket.org/pypy/pypy/changeset/1cf561fab385/

Log:    reserve_buffer() can return NULL

diff --git a/rpython/rlib/rvmprof/src/rvmprof.c 
b/rpython/rlib/rvmprof/src/rvmprof.c
--- a/rpython/rlib/rvmprof/src/rvmprof.c
+++ b/rpython/rlib/rvmprof/src/rvmprof.c
@@ -311,7 +311,13 @@
 RPY_EXTERN
 void rpython_vmprof_write_buf(char *buf, long size)
 {
-    struct profbuf_s *p = reserve_buffer(profile_file);
+    struct profbuf_s *p;
+
+    while ((p = reserve_buffer(profile_file)) == NULL) {
+        /* spin loop waiting for a buffer to be ready; should almost never
+           be the case */
+        usleep(1);
+    }
 
     if (size > SINGLE_BUF_SIZE)
         size = SINGLE_BUF_SIZE;
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to