threading.Condition vs threading.Event

前端 未结 2 1608
醉话见心
醉话见心 2021-01-31 01:58

I have yet to find a clear explanation of the differences between Condition and Event classes in the threading module. I

2条回答
  •  灰色年华
    2021-01-31 02:53

    Another subtle difference is that Event's set() affects future calls of wait() (that is, subsequent calls of wait() will return True and won't block until clear() is called), whereas Condition's notify() (or notify_all()) doesn't (subsequent calls of wait() will block till next call of notify()).

提交回复
热议问题