Add functions ngSpice_LockRealloc and ngSpice_UnlockRealloc

to lock reallocing output vectors, e.g. during reading the
vecs for plotting.
This commit is contained in:
Holger Vogt 2023-11-19 11:33:56 +01:00
parent e87651e27f
commit 1849a8d220
1 changed files with 16 additions and 0 deletions

View File

@ -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 */