当前位置:网站首页>再见SharedPreferences,你好MMKV!
再见SharedPreferences,你好MMKV!
2022-04-21 18:11:00 【InfoQ】
- commit有返回值,表示修改是否提交成功。
- commit提交是同步的,直到磁盘操作成功后才会完成。
- 将一个?awaitCommit?的?Runnable?任务,添加到队列?QueuedWork?中,在awaitCommit中会调用?await()?方法等待,在?handleStopService?、handleStopActivity?等等生命周期会以这个作为判断条件,等待任务执行完毕。
- 将一个?postWriteRunnable?的?Runnable?写任务,通过enqueueDiskWrite?方法,将写入任务加入到队列中,而写入任务在一个线程中执行。
mcr.writtenToDiskLatch.await()- sPendingWorkFinishers?是?ConcurrentLinkedQueue?实例,apply?方法会将写入任务添加到?sPendingWorkFinishers队列中,在单个线程的线程池中执行写入任务,线程的调度并不由程序来控制,也就是说当生命周期切换的时候,任务不一定处于执行状态。
- toFinish.run()?方法,相当于调用?mcr.writtenToDiskLatch.await()?方法,会一直等待。
- waitToFinish()?方法就做了一件事,会一直等待写入任务执行完毕,其它什么都不做,当有很多写入任务,会依次执行,当文件很大时,效率很低,造成 ANR 就不奇怪了。
最后
版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://xie.infoq.cn/article/38a002b60711162725f46f1ec
边栏推荐
- Mongodb用户权限总结
- 终于完成学生时代的梦想-制作掌机用单片机STM32手把手教你
- Huawei cloud gaussdb (for influx) unveiling phase VI - hierarchical data storage
- Look at how the technology house saves Xueba machine. I repaired my laptop with 10 yuan
- VS2019 visual studio 终端调试乱码问题
- 干货 | 读懂 Appium 日志,让测试效率翻倍!
- 西北工业大学机考《财政金融法》网考
- MySQL localization workbench localization XML file
- Download times remaining, link + email can be left
- 最基本的JDBC模板及数据库乱码处理
猜你喜欢

【acwing】1118. 分成互质组 ***(DFS)

ansible简单使用示例

看看项目经理是如何把一个项目带崩的

Mobile platform workplus integrated office, creating a full scene business ecosystem for enterprises

看完这篇教程,你将拥有自己的一个卫星(diy全程详解)

TCP / IP protocol

fastjson自动升级成fastjson2后 IDEA开发环境正常 打成jar包发布生成环境后报错异常 pom.xml的version自动升级导致
![[intensive reading of Thesis] stable linear structures and seam measurements for parallelax image stitching](/img/93/c453cd25883a34d07b2a1b1e6d287c.png)
[intensive reading of Thesis] stable linear structures and seam measurements for parallelax image stitching

Laravel soar (2. X) - automatically monitor and output SQL optimization suggestions and assist laravel to apply SQL optimization

靶机渗透练习70-DC2
随机推荐
靶机渗透练习72-DC4
What can MCU do? Do you have any interesting works made by MCU or open source hardware
Failed to install network card driver (resolved)
[7:00 pm tonight] discussion on the development and application scenarios of metartc
【acwing】166. 数独****(DFS)
What is the default user name and password of MySQL?
After fastjson is automatically upgraded to fastjson2, the idea development environment is normally printed into a jar package and an error exception POM is reported after publishing the generated env
MySQL 8.0 remote connection 2059 exception
靶机渗透练习73-DC5
Part time jobs are higher than wages. In 2022, there are three sidelines with a monthly income of more than 10000
Look at how the technology house saves Xueba machine. I repaired my laptop with 10 yuan
Easy to use example
靶机渗透练习74-DC6
Create a local development cluster using k3s
The conflict between Russia and Ukraine raised concerns. The five eye network security department suggested that allies strengthen the protection of key infrastructure
Logstash ~ filter of logstash
Mycat水平分表(E-R表)
西北工业大学机考《财政金融法》网考
Build a short video platform and copy a demo of the login interface
看完这篇教程,你将拥有自己的一个卫星(diy全程详解)