buf and buf_thread has now read and write waiting queues