Threading issues

1 view
Skip to first unread message

nduplessis

unread,
Apr 23, 2009, 3:56:02 AM4/23/09
to sqlitepersistentobjects-user
I'm using models in different threads and I keep getting "Error
Message: library routine called out of sequence" messages and then my
app would crash. Has anyone seen this before? And are
SQLitePersistentObjects safe to use in threads??

Ken

unread,
Apr 23, 2009, 1:45:40 PM4/23/09
to sqlitepersistentobjects-user
I don't think we've seen any talk regarding threading, or any possible
issues as it relates to SQLPO. You might be pioneering this for the
rest of the group...

From what I've seen of the code, I can see where there may be some
threading issues. There is at least one resource that would be shared
between threads, which stores a cache in memory of objects that have
been retrieved from the DB. It's possible there may be threading
issues with this (and perhaps other) shared resources.

Definitely more discussion needed to talk through these sorts of
issues.

nduplessis

unread,
Apr 27, 2009, 4:56:30 AM4/27/09
to sqlitepersistentobjects-user
I have to admit I'm kind of surprised to see that this issue has not
been raised before. File access is kinda slow so I would have thought
most people would perform the SQL queries in the background

martypicco

unread,
May 11, 2009, 1:38:57 PM5/11/09
to sqlitepersistentobjects-user
Hi,

I have SQLPO objects scattered through my code, and it looks like I
have some UI performance issues that are going to require pushing some
of DB ops onto another thread, so I either need to restructure my code
to put all the DB accesses together so that they can be serialized on
a single operation queue or make SQLPO thread safe (preferred).

Not having dived into the internals, I am hopeful that some well
placed @synchronized() directives can do the trick. To those of you
who do have a good handle on the internals, could you suggest a
strategy / identify key resources&code blocks that should be
protected? I could naively start spraying @syncrhonized() directives
around, but I'm hoping that with a little guidance I could get a
better result with less pain.

Thanks,

Marty

Elijah Windsor

unread,
May 12, 2009, 8:42:59 PM5/12/09
to sqlitepersistentobjects-user
Hello,

First of all, SQLPO is awesome!

Second, I put SQLPO calls in a thread and they seem to work fine. I
made sure to use only one thread for handling all the creation/saving/
releasing. I had it save a new set of data every half second and I
didn't run into any problems. (I've tested this up to 20 minutes, but
no longer than that.)

Hope this helps!

Elijah
Reply all
Reply to author
Forward
0 new messages