process changes
This changes wait_reading_process_output to handle threads better. It
introduces a wrapper for select that releases the global lock, and it
ensures that only a single thread can select a given file descriptor
at a time.
This also adds the thread-locking feature to processes. By default a
process can only have its output accepted by the thread that created
it. This can be changed using set-process-thread. (If the thread
exits, the process is again available for waiting by any thread.)
Note that thread-signal will not currently interrupt a thread blocked
on select. I'll fix this later.