notify_one() 或 notify_all() 如果在锁(mutex spin_lock)里调用,可能会导致被立刻唤醒的线程继续阻塞,因为锁被notify线程持有。
c++标准上说,一些实现(尤其是许多 pthread 的实现)为了归避这种情况,在通知调用中,直接将等待线程从条件变量队列转移到互斥队列,而不唤醒它,来避免此"hurry up and wait"--急于求成 的场景
官方文档: https://en.cppreference.com/w/cpp/thread/condition_variable/notify_one