The code seems perfect to me, but when executed, it only turns an infinite loop and the add_buffer() and sub_buffer() do not execute. Why is the thread unresponsive?