Megatest

Diff
Login

Differences From Artifact [10490588b1]:

To Artifact [b9d134230d]:


1393
1394
1395
1396
1397
1398
1399
1400

1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417


1418
1419
1420
1421



1422
1423
1424
1425
1426
1427
1428
1393
1394
1395
1396
1397
1398
1399

1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415


1416
1417




1418
1419
1420
1421
1422
1423
1424
1425
1426
1427







-
+















-
-
+
+
-
-
-
-
+
+
+








(define (dbfile:simple-file-release-lock fname)
  (handle-exceptions
      exn
      #f ;; I don't really care why this failed (at least for now)
    (delete-file* fname)))

(define (dbfile:with-simple-file-lock fname proc #!key (expire-time 300))
(define (dbfile:with-simple-file-lock fname proc #!key (expire-time 300)(run-anyway #f))
  (let ((start-time (current-seconds))
        (gotlock (dbfile:simple-file-lock-and-wait fname expire-time: expire-time))
        (end-time (current-seconds))
        )
    (if gotlock
	(let ((res (proc)))
	  (dbfile:simple-file-release-lock fname)
	  res)
        (begin
          (dbfile:print-err "dbfile:with-simple-file-lock: " fname " is locked by "
			    (with-input-from-file fname
			      (lambda ()
				(dbfile:print-err (read-line)))))
          (dbfile:print-err "wait time = " (- end-time start-time))
	  (dbfile:print-err "ERROR: simple file lock could not get a lock for " fname " in " expire-time " seconds")
          #f
        )
	  (if run-anyway
	      (let ((res (proc)))
    )
  )
)

		(dbfile:simple-file-release-lock fname)
		res)
	      #f)))))

(define *get-cache-stmth-mutex* (make-mutex))

(define (db:get-cache-stmth dbdat db stmt)
  (mutex-lock! *get-cache-stmth-mutex*)
  (let* (;; (dbdat       (dbfile:get-dbdat dbstruct run-id))
	 (stmt-cache  (dbr:dbdat-stmt-cache dbdat))