select() errors and AnyEvent::Loop
Marc Lehmann
schmorp at schmorp.de
Wed Jun 30 21:30:29 CEST 2021
On Wed, Jun 30, 2021 at 11:44:25AM -0400, Felipe Gasper <felipe at felipegasper.com> wrote:
> > When I make EBADF happen directly the program hangs in a tight loop. I assume the same would go for ENOMEM, and EINVAL shouldn’t be possible in Perl.
> >
> > How is it possible for a program that gets EBADF, EINVAL, or ENOMEM from select() to be correctly working?
I am not sure what your question even means - without knowing the
specification of the program (which defines what correct means), we simply
can't know, but an obvious answer would be: the specs call for the program
to run into this condition and behave this way, puzzle solved.
What we do know is that, by all evidence, AnyEvent and AnyEvent::Loop
behave correctly - obviously, neither module can make guarantees about
user code, or fix it on the fly, or even attempt to guess what needs
fixing (again, maybe this is correct behaviour for the program).
Now, we cna say one thing: barring bugs in AnyEvent, programs that
get EBADF are not correct w.r.t. to AnyEvent's API, so if I had
such a program, I would likely say it cannot work correctly, again
.w.r.t. AnyEvent's API.
But AnyEvent is not a program, and who knows under what curious
circumstances the whole program operates. I can easily imagine cases where
the specification for such a program calls for this, while not affecting
correctness negatively. AnyEvent, being free software you can modify and
use for whatever purpose you see fit, is certainly fine with it, even if
I, personally, wouldn't find this satisfactory.
AnyEvent::Loop does best effort in such cases, which is, however, not a
guarantee made by AnyEvent::Loop, and certainly not by AnyEvent, which
leaves such details to the loop.
None of this seems to be of any relevance to AnyEvent though, which
is why I find your question a bit puzzling. This seems to be a very
theoretical line of thought, more suited for a philosophy of computer
science course :)
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the anyevent
mailing list