Skip to content

Commit e083e4b

Browse files
committed
Add process ID to temp folder name on Windows
to avoid clashes during parallel execution fixes #633
1 parent 0e1374c commit e083e4b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fmusim/FMIZip.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
const char* FMICreateTemporaryDirectory() {
2323

2424
#ifdef _WIN32
25-
const char* tempfile = _tempnam(NULL, NULL);
25+
DWORD processId = GetCurrentProcessId();
26+
27+
char prefix[256] = "fmusim.";
28+
29+
sprintf(&prefix[7], "%lu", processId);
30+
31+
const char* tempfile = _tempnam(NULL, prefix);
2632

2733
if (!tempfile) {
2834
return NULL;

0 commit comments

Comments
 (0)