Skip to content

Commit

Permalink
Make USR1 signal work once again
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16252 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jun 8, 2013
1 parent 6ca4ee2 commit 77c66e4
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions SimulationRuntime/c/simulation/simulation_runtime.cpp
Expand Up @@ -852,15 +852,11 @@ int initRuntimeAndSimulation(int argc, char**argv, DATA *data)
return 0;
}

static DATA *SimulationRuntime_printStatus_data = NULL;
void SimulationRuntime_printStatus(int sig)
{
DATA *data = SimulationRuntime_printStatus_data;
printf("<status>\n");
printf("<phase>UNKNOWN</phase>\n");
/*
* FIXME: Variables needed here are no longer global.
* and (int sig) is too small for pointer to data.
*/
/*
printf("<model>%s</model>\n", data->modelData.modelFilePrefix);
printf("<phase>UNKNOWN</phase>\n");
printf("<currentStepSize>%g</currentStepSize>\n", data->simulationInfo.stepSize);
Expand All @@ -869,7 +865,6 @@ void SimulationRuntime_printStatus(int sig)
printf("<diffOldTime>%g</diffOldTime>\n", data->localData[1]->timeValue-data->localData[2]->timeValue);
printf("<currentTime>%g</currentTime>\n", data->localData[0]->timeValue);
printf("<diffCurrentTime>%g</diffCurrentTime>\n", data->localData[0]->timeValue-data->localData[1]->timeValue);
*/
printf("</status>\n");
}

Expand Down Expand Up @@ -906,6 +901,7 @@ int _main_SimulationRuntime(int argc, char**argv, DATA *data)

/* sighandler_t oldhandler = different type on all platforms... */
#ifdef SIGUSR1
SimulationRuntime_printStatus_data = data; /* Global, but at least we get something back; doesn't matter which simulation run */
signal(SIGUSR1, SimulationRuntime_printStatus);
#endif

Expand Down

0 comments on commit 77c66e4

Please sign in to comment.