summaryrefslogtreecommitdiff
path: root/rts/Hpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/Hpc.c')
-rw-r--r--rts/Hpc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/rts/Hpc.c b/rts/Hpc.c
index 13f2ab87a2..c236cdd07f 100644
--- a/rts/Hpc.c
+++ b/rts/Hpc.c
@@ -203,7 +203,9 @@ startupHpc(void)
return;
}
hpc_inited = 1;
+#if defined(HAVE_GETPID)
hpc_pid = getpid();
+#endif
hpc_tixdir = getenv("HPCTIXDIR");
hpc_tixfile = getenv("HPCTIXFILE");
@@ -387,7 +389,12 @@ exitHpc(void) {
// Any sub-process from use of fork from inside Haskell will
// not clobber the .tix file.
- if (hpc_pid == getpid()) {
+#if defined(HAVE_GETPID)
+ bool is_subprocess = hpc_pid != getpid();
+#else
+ bool is_subprocess = false;
+#endif
+ if (!is_subprocess) {
FILE *f = __rts_fopen(tixFilename,"w+");
writeTix(f);
}