On Sep 18, 2009, at 4:52 AM, s.breith...@staubli.com wrote:

> In my multithreaded applications I use  
> sqlite3_busy_timeout(sqlite3*, int
> ms) to avoid failures on temporary locked databases.
>
> This works fine so far. The only problem is the very poor computer I  
> have
> to use. I made a test to let 3 applications do nothing, but write to  
> the
> database. When I use the function with ms=10000 I get much poorer  
> result,
> than I get when I program the behaviour of the function on my own.
> I think the reason are the sleep times between the write attempts. I  
> get
> better results with longer sleep times, because I do not waste so much
> computing time on write attempts (Of course only valid on my poor
> machine).
>
> First Question: How long does  sqlite3_busy_timeout(sqlite3*, int ms)
> sleep minimal and maximal?

The sqlite3_busy_timeout() function is implemented by using  
sqlite3_busy_handler() to make calls to sqlite3_sleep().  You can  
implement your on variation on this routine that will sleep as little  
or as much as you want.   Look at the source code.  The implementation  
of sqltie3_busy_timeout() is not that complicated.  You should be able  
to see exactly what it is doing.  Make a copy of the code and modify  
your copy to do whatever you want.


>
> Second Questions: Would it be possible the add a function
> sqlite3_busy_timeout_???(sqlite3*, int ms, int minSleepMs)
> where the user can define the minimal sleeptime "minSleepMs" between  
> two
> attempts?
>
> Regards,
> Stefan
>
>
> Best regards / Mit freundlichen Gruessen
>
> Stefan Breitholz
>
> -----------------------------------------------------------------------------------------------------------
> Staeubli GmbH - Theodor-Schmidt-Str. 19
> DE - 95448 Bayreuth
> Phone: +49(0)921/883-126 Fax: +49(0)921/883-58126
> mailto:s.breith...@staubli.com
> http://www.staubli.com
>
> Registered under HRB 175 - Local Court Bayreuth - Managing Director:  
> Karl Kirschner
> -----------------------------------------------------------------------------------------------------------
>
>
> This e-mail and any attachment (the 'message') are confidential and  
> privileged and intended solely for the person or the entity to which  
> it is adressed. If you have received it in error, please advise the  
> sender by return e-mail and delete it immediately. Any use not in  
> accordance with its purpose, any dissemination or reproduction,  
> either whole or partial, by entities other than the intended  
> recipient is strictly prohibited.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

D. Richard Hipp
d...@hwaci.com



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to