summaryrefslogtreecommitdiff
path: root/processmodel
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-05-31 16:53:23 +0100
committerTim Redfern <tim@eclectronics.org>2013-05-31 16:53:23 +0100
commit66210c73084c643c9c7169ca6f46d1cf47489248 (patch)
tree42048b6d5f21b2432e4abd21a59fb1b0d7571c54 /processmodel
parent634bb00a9a4d07dccee6d13f8120793bd0bc55dc (diff)
investigating using a processes rather than threads
Diffstat (limited to 'processmodel')
-rw-r--r--processmodel/processmodel.cpp30
-rw-r--r--processmodel/rendercontext_src/rendercontext.cpp2
2 files changed, 18 insertions, 14 deletions
diff --git a/processmodel/processmodel.cpp b/processmodel/processmodel.cpp
index ee75638..19ad57f 100644
--- a/processmodel/processmodel.cpp
+++ b/processmodel/processmodel.cpp
@@ -13,20 +13,24 @@ using Poco::ProcessHandle;
int main(int argc, char** argv)
{
- std::string cmd("rendercontext");
+
std::vector<std::string> args;
args.push_back("-ax");
- Poco::Pipe outPipe;
- Poco::Pipe inPipe;
- ProcessHandle ph = Process::launch(cmd, args, &inPipe, &outPipe, 0);
- Poco::PipeInputStream istr(outPipe);
- Poco::PipeOutputStream ostr(inPipe);
- //std::ofstream ostr("processes.txt");
- //
- while (true){
- //Poco::StreamCopier::copyStream(istr,std::cout);
- ostr<<std::cin;
- std::cout<<istr;
+ if (argc>1) {
+ std::string cmd=std::string(argv[1]);
+ Poco::Pipe outPipe;
+ Poco::Pipe inPipe;
+ ProcessHandle ph = Process::launch(cmd, args, &inPipe, &outPipe, 0);
+ Poco::PipeInputStream istr(outPipe);
+ Poco::PipeOutputStream ostr(inPipe);
+ //std::ofstream ostr("processes.txt");
+ //
+ while (true){
+ Poco::StreamCopier::copyStream(istr,std::cout);
+ //ostr<<std::cin;
+ //std::cout<<istr;
+ }
+ return 0;
}
- return 0;
+ else std::cerr<<"usage: processmodel [executable]"<<std::endl;
} \ No newline at end of file
diff --git a/processmodel/rendercontext_src/rendercontext.cpp b/processmodel/rendercontext_src/rendercontext.cpp
index d309c22..03acf75 100644
--- a/processmodel/rendercontext_src/rendercontext.cpp
+++ b/processmodel/rendercontext_src/rendercontext.cpp
@@ -11,6 +11,6 @@ int main(int argc, char** argv)
// std::cout<<count<<" "<<std::cin;
// count ++;
//}
- std::cout<<"hello, world!"<<std::endl;
+ std::cout<<"hello, world!"<<std::endl; //;
return 0;
} \ No newline at end of file