Add real support for muting
Add timeout for select

If select is started without timeout, the thread cannot be stopped
until an event occurs.
In addition, the file had DOS newlines.