Whether sqlitedatabase is thread safe or not

Source: Internet
Author: User

Database operations are essentially manipulating database files.

Before Android 2.3.7, the Insertwithonconflict method had lock () before and after obtaining the code block of the Sqlitestatement execution database ... unlock ()}, So to the same database, we have done the mutual exclusion between different threads;

Above the Abdroid 4.0, the source code removed the lock (), for the same database, each thread will hold a sqlitestatement, each thread holds a unique sqlitesession, and a session only belongs to one thread , which guarantees that the transaction is concurrent. Each thread is asynchronous in the database layer, and finally the synchronization control that is done at the native level

   

Whether sqlitedatabase is thread safe or not

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.