sharedspice.c: command bg_pstop to stop printsend

thread before unloading ngspice library
This commit is contained in:
h_vogt 2013-03-26 20:35:41 +01:00
parent 58c9911f27
commit 6c2d820430
1 changed files with 16 additions and 2 deletions

View File

@ -244,6 +244,8 @@ mutexType fputsMutex;
static bool is_initialized = FALSE;
static char* no_init = "Error: ngspice is not initialized!\n Run ngSpice_Init first";
static bool printstopp = FALSE;
/*helper function*//*
static struct plot *
get_plot(int plot)
@ -383,10 +385,22 @@ runc(char* command)
bool fl_bg = FALSE;
command_id = threadid_self();
/* run task in background if command is preceeded by "bg_" */
if (!cieq("bg_halt", command) && (ciprefix("bg_", command))) {
if (!cieq("bg_halt", command) && !cieq("bg_pstop", command) &&(ciprefix("bg_", command))) {
strncpy(buf, command+3, 1024);
fl_bg = TRUE;
}
#ifndef low_latency
/* stop the printf thread 'printsend()' */
else if (cieq("bg_pstop", command)) {
printstopp = TRUE;
#if defined(__MINGW32__) || defined(_MSC_VER)
Sleep(100); // va: windows native
#else
usleep(10000);
#endif
return 2;
}
#endif
else
strncpy(buf, command, 1024);
#else
@ -1070,7 +1084,7 @@ sh_fputs(const char *input, FILE* outf)
again fcn outstoraghe(), top entry is deleted and string is
sent to caller in an endless loop by fcn printsend() */
static wordlist *wlstart = NULL, *wlend = NULL;
static bool printstopp = FALSE;
//static bool printstopp = FALSE;
int