aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-10-22 17:38:58 +0200
committerNicolai Hähnle <[email protected]>2017-11-09 14:01:03 +0100
commite8bb8758ddfa884b55abf8648af9cb7239bc1f66 (patch)
tree62f2f409aaf76ff196a6ea0772faf0235547de6e /src/gallium
parentd6710fe874cce4c01d48279e25210279a06c7543 (diff)
ddebug: use an atomic increment when numbering files
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/ddebug/dd_util.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/drivers/ddebug/dd_util.h b/src/gallium/drivers/ddebug/dd_util.h
index cfc0fb0ccce..bdfb7cc9163 100644
--- a/src/gallium/drivers/ddebug/dd_util.h
+++ b/src/gallium/drivers/ddebug/dd_util.h
@@ -35,6 +35,7 @@
#include "c99_alloca.h"
#include "os/os_process.h"
+#include "util/u_atomic.h"
#include "util/u_debug.h"
/* name of the directory in home */
@@ -56,7 +57,8 @@ dd_get_debug_filename_and_mkdir(char *buf, size_t buflen, bool verbose)
if (mkdir(dir, 0774) && errno != EEXIST)
fprintf(stderr, "dd: can't create a directory (%i)\n", errno);
- snprintf(buf, buflen, "%s/%s_%u_%08u", dir, proc_name, getpid(), index++);
+ snprintf(buf, buflen, "%s/%s_%u_%08u", dir, proc_name, getpid(),
+ p_atomic_inc_return(&index) - 1);
if (verbose)
fprintf(stderr, "dd: dumping to file %s\n", buf);