From eb20a3abf0811971b8af4344502c3eb5a2b1eb24 Mon Sep 17 00:00:00 2001 From: "Gregory J. Ward" Date: Tue, 19 Nov 2024 20:39:40 +0000 Subject: [PATCH] feat: Allow trace call to be changed when children are running --- src/rt/RtraceSimulManager.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/rt/RtraceSimulManager.h b/src/rt/RtraceSimulManager.h index a9f078f5..8e50550e 100644 --- a/src/rt/RtraceSimulManager.h +++ b/src/rt/RtraceSimulManager.h @@ -1,4 +1,4 @@ -/* RCSid $Id: RtraceSimulManager.h,v 2.17 2024/11/13 02:43:51 greg Exp $ */ +/* RCSid $Id: RtraceSimulManager.h,v 2.18 2024/11/19 20:39:40 greg Exp $ */ /* * RtraceSimulManager.h * @@ -138,10 +138,17 @@ class RtraceSimulManager : public RadSimulManager { cookedCall = cb; ccData = cb ? cd : NULL; } - /// Set/change trace callback (before threading) + /// Set/change trace callback void SetTraceCall(RayReportCall *cb, void *cd = NULL) { + if (cb == traceCall) { + if (cb) tcData = cd; + return; + } + int nt = NThreads(); + if (nt > 1) SetThreadCount(1); traceCall = cb; tcData = cb ? cd : NULL; + if (nt > 1) SetThreadCount(nt); } /// Are we ready? bool Ready() const {