SQLite from a lib?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

SQLite from a lib?

John Moser-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm working out an assistive-type program that allows applications
developers to offer help to the user reactive to certain conditions.
This program tracks what messages are sent, reacted to, followed,
dismissed, etc.  I want to store this information using an sqlite
database, as a sort of configuration file.


The library is general purpose.  Basically, any application can use it.
 When it starts, the application has to call

int somosis_spawn_thread(pthread_t *restrict thread,
                char *configfile,
                void (*handler)(int,int));

to spawn a thread with a given config file and handler function.  The
handler will handle responses to messages, if needed, in this separate
thread; this will be a point when the config file is updated.  This
thread will also get application-level configuration data from the
assistant's interface and store the changes in the same SQLite database.

I'm worried here.  Other threads will be sending and killing messages; I
can structure this so that this doesn't need to alter the SQLite
database by simply reacting to the data sent back about the message.  In
the end, if I do it just right, there should be one thread handling the
SQLite database.

Problem here.  Programs like to fork()  :(  Should I simply not be using
SQLite; or is there a way for me to have the thread immediately die in
the child on fork()?

- --
All content of all messages exchanged herein are left in the
Public Domain, unless otherwise explicitly stated.

    Creative brains are a valuable, limited resource. They shouldn't be
    wasted on re-inventing the wheel when there are so many fascinating
    new problems waiting out there.
                                                 -- Eric Steven Raymond
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDCTZyhDd4aOud5P8RAjgCAJ9OweJR33e3ZTF34TpA1kToLi5pUwCeNMyU
vno00sqs4f2JeTaD7cik8ow=
=ws8J
-----END PGP SIGNATURE-----