Raise exceptions when blocked in bad FDs (fixes Trac #4934)
authorSergei Trofimovich <slyfox@gentoo.org>
Fri, 23 May 2014 20:58:06 +0000 (23:58 +0300)
committerSimon Marlow <marlowsd@gmail.com>
Sun, 8 Jun 2014 10:21:11 +0000 (11:21 +0100)
commit9fd507e5758f4141ac2619f0db57136bcab035c6
tree2eb2d698e7d0b634804dd1753400395f352eb00e
parent2f8b4c9330b455d4cb31c186c747a7db12a69251
Raise exceptions when blocked in bad FDs (fixes Trac #4934)

Before the patch any call to 'select()' with 'bad_fd' led to:
- unblocking of all threads
- hiding exception for 'threadWaitRead bad_fd'

The patch fixes both cases in this way:
after 'select()' failure we iterate over each blocked descriptor
and poll individually to see it's actual status, which is:
- READY (move to run queue)
- BLOCKED (leave in blocked queue)
- INVALID (send an IOErrror exception)

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
libraries/base/GHC/Event/Thread.hs
rts/Prelude.h
rts/RtsStartup.c
rts/package.conf.in
rts/posix/Select.c
rts/win32/libHSbase.def