Browse Source

Revert "encapsulate fcn calls to cp_evloop into a mutex"

This reverts commit 2426a037db.
pre-master-46
Holger Vogt 7 years ago
parent
commit
cf752bf730
  1. 24
      src/sharedspice.c

24
src/sharedspice.c

@ -10,7 +10,7 @@
/*******************/
#ifdef _MSC_VER
#define SHAREDSPICE_version "31.0"
#define SHAREDSPICE_version "30.0"
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
@ -276,7 +276,6 @@ unsigned int main_id, ng_id, command_id;
mutexType triggerMutex;
mutexType allocMutex;
mutexType fputsMutex;
mutexType evloopMutex;
#endif
/* initialization status */
@ -336,11 +335,8 @@ _cthread_run(void *controls)
pthread_mutex_unlock(&triggerMutex);
#endif
fl_exited = FALSE;
for (wl = controls; wl; wl = wl->wl_next) {
mutex_lock(&evloopMutex);
for (wl = controls; wl; wl = wl->wl_next)
cp_evloop(wl->wl_word);
mutex_unlock(&evloopMutex);
}
fl_exited = TRUE;
#ifdef HAVE_LIBPTHREAD
cont_condition = FALSE;
@ -358,9 +354,7 @@ _thread_run(void *string)
if (!nobgtrwanted)
bgtr(fl_exited, ng_ident, userptr);
// bgtid = thread_self();
mutex_lock(&evloopMutex);
cp_evloop((char *)string);
mutex_unlock(&evloopMutex);
FREE(string);
// #ifdef __MINGW32__
// bgtid.p = NULL;
@ -459,11 +453,8 @@ exec_controls(wordlist *newcontrols)
#endif
#else
wordlist *wl;
for (wl = shcontrols; wl; wl = wl->wl_next) {
mutex_lock(&evloopMutex);
for (wl = shcontrols; wl; wl = wl->wl_next)
cp_evloop(wl->wl_word);
mutex_unlock(&evloopMutex);
}
#endif
}
@ -571,22 +562,16 @@ runc(char* command)
if (fl_running) {
if (fl_exited) {
_thread_stop();
mutex_lock(&evloopMutex);
cp_evloop(buf);
mutex_unlock(&evloopMutex);
} else {
fprintf(stderr, "Warning: cannot execute \"%s\", type \"bg_halt\" first\n", buf);
}
} else {
/*do the command*/
mutex_lock(&evloopMutex);
cp_evloop(buf);
mutex_unlock(&evloopMutex);
}
#else
mutex_lock(&evloopMutex);
cp_evloop(buf);
mutex_unlock(&evloopMutex);
#endif /*THREADS*/
signal(SIGINT, oldHandler);
return 0;
@ -730,19 +715,16 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi
pthread_mutex_init(&triggerMutex, NULL);
pthread_mutex_init(&allocMutex, NULL);
pthread_mutex_init(&fputsMutex, NULL);
pthread_mutex_init(&evloopMutex, NULL);
cont_condition = FALSE;
#else
#ifdef SRW
InitializeSRWLock(&triggerMutex);
InitializeSRWLock(&allocMutex);
InitializeSRWLock(&fputsMutex);
InitializeSRWLock(&evloopMutex);
#else
InitializeCriticalSection(&triggerMutex);
InitializeCriticalSection(&allocMutex);
InitializeCriticalSection(&fputsMutex);
InitializeCriticalSection(&evloopMutex);
#endif
#endif
// Id of primary thread

Loading…
Cancel
Save