What might be the cause of “long monitor contention event with owner method”?

前端 未结 1 1274
醉话见心
醉话见心 2021-02-07 05:15

I\'m a beginner and I have an assignment of making a basic chat app of two clients and a server exchanging strings which are destination+message.

I have written some cod

1条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 05:54

    It is caused by one thread holding a monitor / mutex for a long time, and blocking other threads. In this case, "a long time" is 100 milliseconds or more. (This pull request is where this check was added.)

    It is a warning ... but you would be advised to look into it as it is likely to lead your application being unresponsive.

    In general, the cure is to reduce the length of time your application needs to hold mutexes. But, without seeing your code, it is hard to advise how you would do this.

    0 讨论(0)
提交回复
热议问题