Commit b4206459 authored by Pavel Vainerman's avatar Pavel Vainerman

Добавил waitpid у порождающих потоки программ.

parent c296e32f
#include <sys/wait.h>
#include <sstream> #include <sstream>
#include "MBTCPMaster.h" #include "MBTCPMaster.h"
#include "Configuration.h" #include "Configuration.h"
...@@ -69,6 +70,7 @@ int main( int argc, const char** argv ) ...@@ -69,6 +70,7 @@ int main( int argc, const char** argv )
dlog(Debug::ANY) << "\n\n\n"; dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- MBTCP Exchange START -------------------------\n\n"; dlog[Debug::ANY] << "(main): -------------- MBTCP Exchange START -------------------------\n\n";
act.run(false); act.run(false);
while( waitpid(-1, 0, 0) > 0 );
return 0; return 0;
} }
catch( Exception& ex ) catch( Exception& ex )
...@@ -80,5 +82,6 @@ int main( int argc, const char** argv ) ...@@ -80,5 +82,6 @@ int main( int argc, const char** argv )
dlog[Debug::CRIT] << "(mbtcpmaster): catch ..." << std::endl; dlog[Debug::CRIT] << "(mbtcpmaster): catch ..." << std::endl;
} }
while( waitpid(-1, 0, 0) > 0 );
return 1; return 1;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#include <sys/wait.h>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <cc++/socket.h> #include <cc++/socket.h>
...@@ -74,6 +75,7 @@ int main(int argc, const char **argv) ...@@ -74,6 +75,7 @@ int main(int argc, const char **argv)
dlog[Debug::ANY] << "(main): -------------- MBSlave START -------------------------\n\n"; dlog[Debug::ANY] << "(main): -------------- MBSlave START -------------------------\n\n";
act.run(false); act.run(false);
while( waitpid(-1, 0, 0) > 0 );
return 0; return 0;
} }
catch( SystemError& err ) catch( SystemError& err )
...@@ -93,6 +95,7 @@ int main(int argc, const char **argv) ...@@ -93,6 +95,7 @@ int main(int argc, const char **argv)
dlog[Debug::CRIT] << "(mbslave): catch(...)" << endl; dlog[Debug::CRIT] << "(mbslave): catch(...)" << endl;
} }
while( waitpid(-1, 0, 0) > 0 );
return 1; return 1;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#include <sys/wait.h>
#include <sstream> #include <sstream>
#include "ObjectsActivator.h" #include "ObjectsActivator.h"
#include "Extensions.h" #include "Extensions.h"
...@@ -68,8 +69,8 @@ int main( int argc, char** argv ) ...@@ -68,8 +69,8 @@ int main( int argc, char** argv )
dlog[Debug::ANY] << "(main): -------------- RTU Exchange START -------------------------\n\n"; dlog[Debug::ANY] << "(main): -------------- RTU Exchange START -------------------------\n\n";
act.run(false); act.run(false);
// msleep(500);
// rs->execute(); while( waitpid(-1, 0, 0) > 0 );
return 0; return 0;
} }
catch( Exception& ex ) catch( Exception& ex )
...@@ -81,5 +82,6 @@ int main( int argc, char** argv ) ...@@ -81,5 +82,6 @@ int main( int argc, char** argv )
dlog[Debug::CRIT] << "(rtuexchange): catch ..." << std::endl; dlog[Debug::CRIT] << "(rtuexchange): catch ..." << std::endl;
} }
while( waitpid(-1, 0, 0) > 0 );
return 1; return 1;
} }
...@@ -69,7 +69,7 @@ int main( int argc, const char** argv ) ...@@ -69,7 +69,7 @@ int main( int argc, const char** argv )
dlog[Debug::ANY] << "(main): -------------- UDPReceiver START -------------------------\n\n"; dlog[Debug::ANY] << "(main): -------------- UDPReceiver START -------------------------\n\n";
act.run(false); act.run(false);
while (waitpid(-1, 0, 0)); while( waitpid(-1, 0, 0) > 0 );
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
...@@ -86,6 +86,6 @@ int main( int argc, const char** argv ) ...@@ -86,6 +86,6 @@ int main( int argc, const char** argv )
dlog[Debug::CRIT] << "(unetexchange): catch ..." << std::endl; dlog[Debug::CRIT] << "(unetexchange): catch ..." << std::endl;
} }
while (waitpid(-1, 0, 0)); while( waitpid(-1, 0, 0) > 0 );
return 0; return 0;
} }
#include <sys/wait.h>
#include <string> #include <string>
#include "Debug.h" #include "Debug.h"
#include "ObjectsActivator.h" #include "ObjectsActivator.h"
...@@ -52,6 +53,7 @@ int main(int argc, const char **argv) ...@@ -52,6 +53,7 @@ int main(int argc, const char **argv)
act.broadcast( sm.transport_msg() ); act.broadcast( sm.transport_msg() );
act.run(true); act.run(true);
shm->execute(); shm->execute();
while( waitpid(-1, 0, 0) > 0 );
return 0; return 0;
} }
catch(SystemError& err) catch(SystemError& err)
...@@ -67,5 +69,6 @@ int main(int argc, const char **argv) ...@@ -67,5 +69,6 @@ int main(int argc, const char **argv)
unideb[Debug::CRIT] << "(uninetwork): catch(...)" << endl; unideb[Debug::CRIT] << "(uninetwork): catch(...)" << endl;
} }
while( waitpid(-1, 0, 0) > 0 );
return 1; return 1;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment