registry: use sqlite3_busy_timeout This caps CPU usage of MacPorts processes waiting for the registry database while it is exclusively locked at about 1.5%. This could be further reduced by using a busy handler and adjusting the timeout depending on the number of calls to the busy handler.
--- trunk/base/src/cregistry/registry.c 2012-12-03 23:43:54 UTC (rev 100216)
+++ trunk/base/src/cregistry/registry.c 2012-12-04 00:12:26 UTC (rev 100217)
@@ -118,6 +118,8 @@
sqlite3_extended_result_codes(reg->db, 1);
#endif
+ sqlite3_busy_timeout(reg->db, 25);
+
if (init_db(reg->db, errPtr)) {
reg->status = reg_none;
*regPtr = reg;