io: add stream_lock