On Fri, Sep 21, 2012 at 6:30 AM, Phil Cockfield <[email protected]> wrote:
>
> I'm seeing my app crash when I'm using SQLite (via the sqlite-net ORM) when 
> invoking a connection made on one thread from another thread (via a TPL Task).
>
> Nic pointed me to some documentation for SQLite that talked about threading 
> with SQLite:
>
> https://mail.google.com/mail/u/0/#inbox/139dfbb3b161e48e
>
>

we can't open links from your mailbox ;-)

>
> This refers to 3 ways that SQLite can be used - but in terms of how's it's 
> built at compile time, and how a connection is established.  One of the 
> options "serialized" claims to be thread safe.
>
> I'm wondering:
>
> Is the version of SQLite compiled on iOS in a way that can be connected to in 
> a thread safe way?


Yes. IIRC it's ThreadSafe - which means you need to use the connection
in the thread that creates it.

>
> Is it possible to get sqlite-net to establish a thread safe connection?

ThreadSafe _is_ thread-safe as long as everything stays in the same thread.

Serialized is "safer" (and potentially slower) since the library will
ensure that only a single operation is done at one time.

    SqliteConnection.SetConfig (SQLiteConfig.Serialized);

You must set the threading configuration very early in your
application. Otherwise (if sqlite was used) it will return you an
error (check the return value) and the default mode will be used.

Sebastien
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to