From: Tim W. <tim...@gm...> - 2004-11-29 14:22:45
|
Yves, How much do I get if I told you I've found the solution? :) OK, I admit, it seems odd, but I've encountered this next comment in a piece of Perl (yes, Perl) code: # Open the fifo read/write, not just read. This is necessary because # of the POSIX rules about using select() on named pipes when no writers # are present. This is a very key step that is hard to find documentation # about. (note the last sentence!) So I tried exactly that: change log_fd[i]->fd = open(filename+1, O_RDONLY); to log_fd[i]->fd = open(filename+1, O_RDWR); and that's it ! Works in 103.2 and 104.1 (perfparsed 104.1 compiles, but doesn't write anyhting to the db... :(, but that's another problem I guess. More tomorrow... ) happy coding, Tim On Fri, 26 Nov 2004 17:08:42 +0100 (CET), Yves <yme...@pe...> wrote: > > > Yves, > > > > Recompiling with the log_source_nonblock(i) line commented out does > > not change anything. The CPU still sky-rockets, and the 4 lines still > > show up (a gazillion times) in strace output. > > So I just suggest that you upgrade to 0.104.1 this week-end, when Ben releases it, and I > will try to find out why there is always something to read on the pipe for select(). > > The only thing I can suggest you now, if you really want a hacked solution, is to put > this in log_reader() : > > while(10 == (r=read(...))) { > ... > } > if((r>0) && (r<10)) { > ... > } else if(r == 0) { > sleep(1); > } > > Add the 2 last lines to sleep the program when it reads nothing. The CPU should still > sky-rocket, but passengers will now have 1 second to get inside the rocket :) > > I will try to find something better for 0.104.2 or 0.105 or course :) > > Yves > PS. uncomment back log_source_nonblock(i) because it may have side effects. > > -- > > > - Homepage - http://ymettier.free.fr - http://www.logicacmg.com - > - GPG key - http://ymettier.free.fr/gpg.txt - > - Maitretarot - http://www.nongnu.org/maitretarot/ - > - Perfparse - http://perfparse.sf.net/ - > > |