-
Notifications
You must be signed in to change notification settings - Fork 728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
线程同步问题 #157
Comments
BluetoothClientImpl 类里面的代码,比如mCountDownLatch 这个对象 在bindServiceSync 赋值了,没有来得及同步导致notifyBluetoothManagerReady 方法里为null |
不会,mCountDownLatch赋值是在bindServiceSync之前,这段代码是在同一个线程的,notifyBluetoothManagerReady必然是在mCountDownLatch赋值之后回调的,是不会为空的 |
根据happens-before原则也能推到出来 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这段代码 我想问下 mBluetoothService 和 mCountDownLatch 对象会不会存在线程同步问题,应为 mConnection的回调方法和bindServiceSync不在同一个线程!mConnection的回调在主线程,这种赋值操作不在一个线程会不会有问题
The text was updated successfully, but these errors were encountered: