From 1849a8d220aaf592f985dfa87f91fafd1a4c8960 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 19 Nov 2023 11:33:56 +0100 Subject: [PATCH] Add functions ngSpice_LockRealloc and ngSpice_UnlockRealloc to lock reallocing output vectors, e.g. during reading the vecs for plotting. --- src/sharedspice.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/sharedspice.c b/src/sharedspice.c index 10145c845..1563e040f 100644 --- a/src/sharedspice.c +++ b/src/sharedspice.c @@ -775,6 +775,8 @@ read_initialisation_file(const char *dir, const char *name) /* The functions exported explicitely from shared ngspice */ /**********************************************************/ + + #ifdef THREADS /* Checks if ngspice is running in the background */ @@ -1337,6 +1339,20 @@ char** ngSpice_AllEvtNodes(void) } #endif +/* Lock/unlock realloc of result vectors during plotting */ +IMPEXP +int ngSpice_LockRealloc(void) +{ + mutex_lock(&vecreallocMutex); + return 1; +} + +IMPEXP +int ngSpice_UnlockRealloc(void) +{ + mutex_unlock(&vecreallocMutex); + return 1; +} /* add the preliminary breakpoints to the list. called from dctran.c */