Blocking and waiting for an event

后端 未结 5 1630
不知归路
不知归路 2020-12-15 03:45

It sometimes want to block my thread while waiting for a event to occur.

I usually do it something like this:

private AutoResetEvent _autoResetEvent          


        
5条回答
  •  温柔的废话
    2020-12-15 04:23

    Don't pass the event, pass a delegate that matches the event handler signature. This actually sounds hacky to me, so be aware of potential dead lock issues.

提交回复
热议问题