Update to comments, restrict mutex definitions to shared ngspice

This commit is contained in:
Holger Vogt 2023-11-19 11:32:25 +01:00
parent 3619041e26
commit e87651e27f
1 changed files with 8 additions and 3 deletions

View File

@ -7,6 +7,8 @@
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "ngspice/dvec.h" #include "ngspice/dvec.h"
#if defined SHARED_MODULE
/*Use Windows threads if on W32 without pthreads*/ /*Use Windows threads if on W32 without pthreads*/
#ifndef HAVE_LIBPTHREAD #ifndef HAVE_LIBPTHREAD
@ -46,6 +48,7 @@ static bool cont_condition;
extern mutexType vecreallocMutex; extern mutexType vecreallocMutex;
#endif
struct dvec *dvec_alloc(/* NOT const -- assigned to char */ char *name, struct dvec *dvec_alloc(/* NOT const -- assigned to char */ char *name,
int type, short flags, int length, void *storage) int type, short flags, int length, void *storage)
@ -103,7 +106,7 @@ struct dvec *dvec_alloc(/* NOT const -- assigned to char */ char *name,
} /* end of function dvec_alloc */ } /* end of function dvec_alloc */
/* Resize dvec to length if storage is NULL orr replace /* Resize dvec to length if storage is NULL or replace
* its existing allocation with storage if not * its existing allocation with storage if not
*/ */
void dvec_realloc(struct dvec *v, int length, void *storage) void dvec_realloc(struct dvec *v, int length, void *storage)
@ -132,8 +135,10 @@ void dvec_realloc(struct dvec *v, int length, void *storage)
} /* end of function dvec_realloc */ } /* end of function dvec_realloc */
/* called from plotAddReal(Complex)Value, to increase /* called from plotAddReal(Complex)Value, to increase
storage for result vectors. Locking and unlocking storage for result vectors.
is done by API functions ng_veclock(), ng_vecunlock(). */ In shared ngspice this may be locked, e.g. during plotting in the primary
thread, while the simulation is running in the background thread. Locking and unlocking
is done by API functions ngSpice_LockRealloc(), ngSpice_UnlockRealloc(). */
void dvec_extend(struct dvec *v, int length) void dvec_extend(struct dvec *v, int length)
{ {
#if defined SHARED_MODULE #if defined SHARED_MODULE