Skip to content

Making Transaction Thread Safe

Siminov Framework edited this page Dec 25, 2015 · 15 revisions

Making Transaction Thread Safe

By default any transaction executed on database is not thread safe, android provides API to make all transaction thread-safe by using locks around critical sections. This is pretty expensive, so if you know that your DB will only be used by a single thread then you should not use this in your application.

Android API: Transaction Thread Safe

    public void setTransactionSafe(boolean isTransactionSafe);

iOS API: Transaction Thread Safe

    - (void)setTransactionSafe:(bool)isTransactionSafe;

Windows API: Transaction Thread Safe

    public void SetTransactionSafe(bool isTransactionSafe);

Configuring transaction thread-safe in siminov. To enable/disable transaction thread-safe in Core you have to use property is locking required defined in DatabaseDescriptor.xml file.

Android Sample: Transaction Thread Safe

![Android Sample: Transaction Thread Safe] (https://raw.github.com/Siminov/core/docs/github/v2.0/transaction_safe.android.png "Android Sample: Transaction Thread Safe")


iOS Sample: Transaction Thread Safe

![iOS Sample: Transaction Thread Safe] (https://raw.github.com/Siminov/core/docs/github/v2.0/transaction_safe.ios.png "iOS Sample: Transaction Thread Safe")


Windows Sample: Transaction Thread Safe

![Windows Sample: Transaction Thread Safe] (https://raw.github.com/Siminov/core/docs/github/v2.0/transaction_safe.windows.png "Windows Sample: Transaction Thread Safe")