MINOR: threads: make use of thread_mask() to simplify some thread calculations

By doing so it's visible that some fd_insert() calls were relying on
MAX_THREADS while all_threads_mask should have been more suitable.
4 files changed