From: Mark D. <mar...@zn...> - 2007-03-30 21:27:40
|
Johan, Thank you very much for the feedback. I shall update the documents so that it is clear your own code must add line endings. I might also have two methods: Write WriteLine On the timer, there is a default 500 millisecond delay on polling. The code that reads input will keep reading line by line and raise an event for each line until the buffer is empty, and then timeout for 500ms. It operates this way so that if you are running multiple processes you get a line from each in turn rather than any single process 'blocking' reads from everything else. Writes are serialized with the reads so the net effect of a write / read response is 500 * 2 which is exactly the 1 second you have observed. The 'timer' used for polling is the Wx::Timer which claims between 1 second and 1 millisecond accuracy depending on the OS and, no doubt, a multitude of other factors. The same polling timer is shared between all external processes that are running. The timer only runs when you actually have external processes running. I shall add a PollingInterval method so that the timing can be set to whatever is suitable. I'll leave 500ms as the default. Many thanks for the feedback - I'm pleased that it worked for you. Best Regards Mark Johan Vromans wrote: > Mark Dootson <mar...@zn...> writes: > >> Tests complete OK on MSWin32 / Linux, both with Wx-0.70 + wxWidgets 2.8.3 >> available at http://www.wxperl.co.uk/processstream.html >> I'd appreciate any comments and views on code, process and namespace. > > As far as I can test, it does exactly what it is supposed to do! > > The only problem I had (and that took me hours of debugging) was why > the slave process wouldn't read the data that was written to it using > WriteProcess. > > Well, the slave used <STDIN>, and it was just patiently waiting for > the newline before making any input available. I was slighty misled by > the documentation: > > $process->WriteProcess('a message to stdin'); > > Which I'd suggest to change to: > > $process->WriteProcess("a message to stdin\n"); > > as a reminder that newlines are important. > > When playing Q & A with a slave program I noticed that the response is > not snappy. Apparently there's a 1-second poll interval hidden > somewhere. It would be nice it this could be reduced to 200ms or > something similar. (But it could be hidden deeply in Wx -- didn't > investigate). > > For me, this module is exactly what I've needed for a long time! > > Thanks, > Johan > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > wxperl-users mailing list > wxp...@li... > https://lists.sourceforge.net/lists/listinfo/wxperl-users |