On Wed, 2013-08-07 at 08:16 +0200, David López González wrote: > Hi everyone, > > I need to access to a single data base with diferent processes, and > eventually, I always get an access error "Error: 5, database is locked". > A simplified code which reproduce the problem it's presented below.
Take a look at [1]. I know unlock notify isn't what you're after (since you have multiple processes, not multiple threads), but IIRC it should give you a pretty good feel for sqlite does. Really, the only option is to just retry the operation. You can do this automatically using sqlite3_busy_timeout ([2]). It is bound as Sqlite.Database.busy_timeout. There is also sqlite3_busy_handler ([3])... I don't think it's bound in Vala at the moment, but it would be trivial to add it to the bindings (or just use the extern keyword). Theoretically you could use it to iterate through the main loop or something while you wait, but it's a lot simpler to just use busy_timeout and interact with sqlite in a thread if you really need to. -E [1] https://sqlite.org/unlock_notify.html [2] https://sqlite.org/c3ref/busy_timeout.html [3] https://sqlite.org/c3ref/busy_handler.html _______________________________________________ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list