Allow ngspice to run in the background.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14085
This commit is contained in:
Jeff Young 2023-06-17 23:53:57 +01:00
parent 7f453d7943
commit b1d5da3da3
1 changed files with 3 additions and 18 deletions

View File

@ -297,29 +297,14 @@ bool NGSPICE::LoadNetlist( const std::string& aNetlist )
bool NGSPICE::Run()
{
LOCALE_IO toggle; // ngspice works correctly only with C locale
bool success = Command( "bg_run" ); // bg_* commands execute in a separate thread
if( success )
{
// wait for end of simulation.
// calling wxYield() allows printing activity, and stopping ngspice from GUI
// Also note: do not user wxSafeYield, because when using it we cannot stop
// ngspice from the GUI
do
{
wxMilliSleep( 50 );
wxYield();
} while( m_ngSpice_Running() );
}
return success;
LOCALE_IO toggle; // ngspice works correctly only with C locale
return Command( "bg_run" ); // bg_* commands execute in a separate thread
}
bool NGSPICE::Stop()
{
LOCALE_IO c_locale; // ngspice works correctly only with C locale
LOCALE_IO c_locale; // ngspice works correctly only with C locale
return Command( "bg_halt" ); // bg_* commands execute in a separate thread
}