java - Infinite loop thread reading from pipe enters a timed_waiting -
java - Infinite loop thread reading from pipe enters a timed_waiting -
i need thread running in background reading pipe loop stops & when display thread state find in timed_waiting how prevent such behavior,below code running within thread, in advance.
bufferedreader in = null; while (started) { string xml = ""; // char [] buf=new char[250]; seek { in = new bufferedreader(new filereader(pipename)); while (!in.ready()) { } // in.read(buf,0,buf.length); xml = in.readline(); // in.close(); } grab (exception e) { system.out.println("error:" + e.getmessage()); continue; } if (xml != null && !xml.equals("")) { system.out.println("recieved: " + xml); } }
edit: after using @thomas's link programme runs fine print when seek parse pr functions on string info read becomes united nations stable & incomplete
sorry @thomas delay, when first asked question had 2 c programs , 1 java, first c programme write in pipe unlinks while other 1 writes many times if unlinks pipe thread in java stops after interval of time, if doesn't unlink info recieved & printed according edit assumed @gregkopff when add together xml parsing info written sec programme info arrives corrupted & missing, assumed xml parsing takes much time, changed format of info sent adding separator, know not considered solution worked me, sorry 1 time again delay if want version of please ask, hope it's helpful
java multithreading named-pipes
Comments
Post a Comment