add blocking read (timeout=0) support for single threading