Have the trigger function set a flag or put an item in a work queue
after it updates the database. After the commit, check/clear the flag
or empty the work queue, raising the semaphore if necessary.

--- Bill Gatliff <[EMAIL PROTECTED]> wrote:
> My application is a mobile platform with a GUI that wants to display 
> frequently-updated data in a database.  The GUI is a separate process 
> from the one providing the data, and is one of several consumers of that 
> data.
> 
> I prefer not to poll for changes, because the system is 
> performance-constrained.  So instead, I'm using an AFTER UPDATE trigger 
> in the data-generating process to launch a C function that posts to a 
> semaphore.  The GUI process is thus unblocked, and it then does a SELECT 
> to get the data.  I'm using the C/C++ API everywhere.
> 
> The problem I'm seeing is that the GUI process is getting stale data in 
> its SELECT, unless it does a brief sleep between the sem_wait() and the 
> sqlite3_exec().  Specifically, the value returned is the value 
> immediately before the UPDATE.  It's as if the trigger in the 
> data-generating process and the query in the GUI process are both 
> running before the new value is actually committed to the database file 
> and/or whatever caches are in between.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to