Thread bocking with waiting queue