Hi Igor,

Sorry.

>>Unless your threads do something else in parallel, you could just as well
do all SQLite work on a single thread

doubt: all are parallel threads. started at same time. one thread is
writing and others are reading at the same time by using same sqlite3*.

I passed same sqlite3* as an argument to 4 posix threads. Among 4, three
threads are reading (selct name from table where id < 100000*index) from
database. Fourth thread is writer thread, which is inserting into database.

In this scenario, all are parallel. three threads are accessing database
for read and another one for write.

It's working fine in my sample application with WAL mode only.

my main doubt is: same sqlite3* is passing to 4 threads from the primary
thread.

Is it correct way to implement multiple readers and single writer?

please ignore intel tbb.

Regards,

On Mon, Jul 23, 2012 at 5:17 PM, Igor Tandetnik <itandet...@mvps.org> wrote:

> Durga D <durga.d...@gmail.com> wrote:
> >   I have used same gdbconn for all the threads. In my sample application,
> > it working perfectly in wal mode.
> >
> >   Is it correct approach?
>
> Approach to what? You've never stated the problem you are trying to solve.
>
> With this setup, you don't get any concurrency out of your four threads.
> All SQLite API calls are serialized on one mutex associated with the
> connection. Unless your threads do something else in parallel, you could
> just as well do all SQLite work on a single thread.
>
> >   If yes, will tbb improves the performance for reader_threads?
>
> What's "tbb"?
> --
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to