Megatest

Check-in [fd0b9485a3]
Login
Overview
Comment:typos
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | v1.64-coalesced-queries
Files: files | file ages | folders
SHA1: fd0b9485a39fe48535bee8212a1e85be21270089
User & Date: matt on 2017-07-04 09:32:11
Other Links: branch diff | manifest | tags
Context
2017-07-04
09:32
typos Closed-Leaf check-in: fd0b9485a3 user: matt tags: v1.64-coalesced-queries
2017-07-03
21:46
small fixes check-in: 948b22f1a9 user: matt tags: v1.64-coalesced-queries
Changes

Modified api.scm from [00c1b8c41b] to [e9ddc4ee15].

348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368

369
370
371
372
373
374
375

;; api queued request handler
;;
;; qry-type: read write transaction
;;
(define (api:queued-request queues qry-type params proc)
  ;; add proc to read, write queue or if transaction do it immediately (for now, not sure but might need to process differently.)
  (if *queues*
      (begin
	(mutex-lock! (api:queue-mutex queues))
	(let ((dat (vector proc params #f))) ;; #f is placeholder for the result
	  (case qry-type
	    ((read)
	     (api:queue-readq-set!  queues (cons dat (api:queue-readq queues)))
	     (mutex-unlock! (api:queue-mutex queues)(api:queue-read-cvar queues)) ;; unlock mutex and proceed when condition var is triggered
	     (vector-ref dat 2)) ;; return the value from the query to the caller
	    ((write)
	     (api:queue-writeq-set! queues (cons dat (api:queue-writeq queues)))
	     (mutex-unlock! (api:queue-mutex queues)(api:queue-write-cvar queues)) ;; unlock mutex and proceed when condition var is triggered
	     (vector-ref dat 2))
	    (else

	     (proc)))))
      (proc)))

;; process queues
;;
(define (api:process-queues queues)
  (mutex-lock (api:queues-mutex queues))







|

|



|
|


|
|


>







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376

;; api queued request handler
;;
;; qry-type: read write transaction
;;
(define (api:queued-request queues qry-type params proc)
  ;; add proc to read, write queue or if transaction do it immediately (for now, not sure but might need to process differently.)
  (if queues
      (begin
	(mutex-lock! (api:queues-mutex queues))
	(let ((dat (vector proc params #f))) ;; #f is placeholder for the result
	  (case qry-type
	    ((read)
	     (api:queues-readq-set!  queues (cons dat (api:queues-readq queues)))
	     (mutex-unlock! (api:queues-mutex queues)(api:queues-read-cvar queues)) ;; unlock mutex and proceed when condition var is triggered
	     (vector-ref dat 2)) ;; return the value from the query to the caller
	    ((write)
	     (api:queues-writeq-set! queues (cons dat (api:queues-writeq queues)))
	     (mutex-unlock! (api:queues-mutex queues)(api:queues-write-cvar queues)) ;; unlock mutex and proceed when condition var is triggered
	     (vector-ref dat 2))
	    (else
	     (mutex-unlock! (api:queues-mutex queues))
	     (proc)))))
      (proc)))

;; process queues
;;
(define (api:process-queues queues)
  (mutex-lock (api:queues-mutex queues))