Am 19.12.2015 um 23:31 schrieb Sudarshan S Chawathe: > Thanks for the update. I see the same behavior with tests/run.scm as > before: Compilation with csc is fine, but executing the resulting file > 'run' gives exactly the same error as before: > > Error: assertion failed: (= (obox-v b1) 455) > > (Detailed error message is same as in my earlier message.)
Hm, that's strange. I blindly assumed this to somehow follow from the import gone wrong. Now I did no do much yesterday but re-run this over and over again to tune the implementation. Neither on 4.9.1 or master. Could you please _replace_ the let form in run.scm starting around line 217 with the one below and try. Should give me more details. The expected output: D #<thread: thread182>: also in other thread former ref is still unchanged... D even after commit. (Note: tests caching of references to fields.): 9 T2 x cc 2 6 T1 x cc 2 7 T2 y cc 2 7 T2 done cc 2 65 T1 y cc -2 6 T1 done cc -2 42 T1 x cc -3 7 T1 y cc -3 65 T1 done cc -3 455 D M1: not-owned D M2: not-abandoned Locking 20000 op in 1530.0 ms (13.0718954248366 op/ms) Optimistic 20000 op in 1324.0 ms (15.1057401812689 op/ms) Thanks for your help. /Jörg Here the more verbose test expression: (let ((mux1 (make-mutex 'T1)) (mux2 (make-mutex 'T2)) (call-count 0)) (define (step! msg mux1 mux2 val) (mutex-unlock! mux1) (if (and mux2 (> call-count 0) (< call-count 100)) (mutex-lock! mux2 #f #f)) (if msg (format (current-error-port) "~a cc ~a ~a\n" msg call-count val)) val) (mutex-lock! mux1 #f #f) (mutex-lock! mux2 #f #f) (thread-start! (lambda () (call-with-transaction (lambda (tnx) (if (>= call-count 0) (set! call-count (add1 call-count)) (set! call-count (sub1 call-count))) (if (< call-count 100) (let ((a (obox-v-ref b2 tnx)) (b (obox-v-ref b1 tnx))) ;; Normally one should never do this. We enforce thread ;; switches during transaction. (alter! a (let* ((x (step! "T2 x" mux1 mux2 (cell-ref a))) (y (step! "T2 y" mux1 mux2 (cell-ref b)))) (+ 23 (* x y)))) (step! "T2 done" mux1 #f (cell-ref a))) (step! "T2 call count exceeded" mux1 #f call-count)))) (set! call-count (- call-count)))) (call-with-transaction (lambda (tnx) (if (>= call-count 0) (set! call-count (add1 call-count)) (set! call-count (sub1 call-count))) (let ((a (obox-v-ref b1 tnx)) (b (obox-v-ref b2 tnx))) (alter! a (let* ((x (step! "T1 x" mux2 mux1 (cell-ref a))) (y (step! "T1 y" mux2 mux1 (cell-ref b)))) (* x y))) (step! "T1 done" mux2 #f (cell-ref a))))) (assert (= call-count -3)) ;; -- not defined to be -3, but normally (dbg 'M1 (mutex-state mux1)) (dbg 'M2 (mutex-state mux2)) (assert (= (obox-v b1) 455)) (assert (= (obox-v b2) 65))) _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users