in reply to Re: Re: resource control: FD
in thread resource control: FD
unfortunately a public api for that piece of the task structure has never been exposed. I looked for some api but couldn't find one. If you're opening pretty fast, you could always use fileno to let you know how close you are to the max but once you get going heavy and start closing, reuse will kick in and that will break.
I have to ask but what are you going to do when you get close to the max? Sleep? Can't you replicate that same behaviour by wrapping the open(s) in an eval? It seems to me, the following would be equivalent:
# the way you want if( magical_how_many_open() < $what_i_need ) { do_wait_some_how(); } # the way you're being pushed eval { open( $fh, "whatever" ); }; if( $@ ) { if( $@ eq "Too many open files" ) { do_wait_some_how(); } else { degrade_gracefully(); } }
-derby
|
|---|