Ishant Sagar
Ishant Sagar

Reputation: 228

android can single instance of SQLiteDatabase manage synchronization between multiple threads?

I need to do writing into the database from different AsyncTask threads but the problem is that we need to be sure that at one time only one thread should be in the process of writing into the db? My question is if i use the singleton pattern in making the single instance of SQLiteDatabase object all over the application,will that single instance manage the synchronization between different threads or not ? Thanks

Upvotes: 2

Views: 2638

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007359

My question is if i use the singleton pattern in making the single instance of SQLiteDatabase object all over the application,will that single instance manage the synchronization between different threads or not ?

Yes, it will.

Upvotes: 3

Related Questions