Android java.lang.IllegalMonitorStateException: object not locked by thread before wait()

后端 未结 4 777
夕颜
夕颜 2020-12-19 02:13

I define a global static object as a synchronization lock.

public static Object ConfirmationSynObj = new Object();

The following function i

4条回答
  •  情深已故
    2020-12-19 02:49

    You might be creating and starting the thread in the synchronized block, but when the thread comes to Config.ConfirmationSynObj.notify(); you'll notice that there's no synchronization.

    You'll need to add a synchronized block inside run().

提交回复
热议问题