From efe9460aec9575a9fd76fff3946de2dad3644caa Mon Sep 17 00:00:00 2001 From: emixa-d Date: Sun, 10 Nov 2024 17:11:11 +0100 Subject: [PATCH] Revert "operations: Add cancel function to ." This reverts commit cbb433facf34dac44904fbf3c089f096f0be5755. --- fibers/operations.scm | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/fibers/operations.scm b/fibers/operations.scm index 6253d606..b5e385fe 100644 --- a/fibers/operations.scm +++ b/fibers/operations.scm @@ -60,37 +60,21 @@ choice-operation perform-operation - make-base-operation - make-base-operation/internal)) + make-base-operation)) ;; Three possible values: W (waiting), C (claimed), or S (synched). ;; The meanings are as in the Parallel CML paper. (define-inlinable (make-op-state) (make-atomic-box 'W)) (define-record-type - (%make-base-operation wrap-fn try-fn block-fn cancel-fn) + (make-base-operation wrap-fn try-fn block-fn) base-op? ;; ((arg ...) -> (result ...)) | #f (wrap-fn base-op-wrap-fn) ;; () -> (thunk | #f) (try-fn base-op-try-fn) ;; (op-state sched resume-k) -> () - (block-fn base-op-block-fn) - ;; (sched) -> () - (cancel-fn base-op-cancel-fn)) ;for internal use so far - -(define* (make-base-operation/internal wrap-fn try-fn block-fn - #:optional (cancel-fn (const #f))) - "This internal-use-only variant of @code{make-base-operation} has an extra -@var{cancel-fn} argument: a procedure to cancel this operation when, as part -of a \"choice\" operation, it has not been chosen. - -This variant is kept internal while the interface and its consequences are -being discussed. Do NOT use it in external code." - (%make-base-operation wrap-fn try-fn block-fn cancel-fn)) - -(define (make-base-operation wrap-fn try-fn block-fn) - (%make-base-operation wrap-fn try-fn block-fn (const #f))) + (block-fn base-op-block-fn)) (define-record-type (make-choice-operation base-ops) @@ -137,18 +121,6 @@ succeeds, will succeed with one and only one of the sub-operations ((base-op) base-op) (base-ops (make-choice-operation (list->vector base-ops))))) -(define (cancel-other-operations op index) - "Assuming @var{op} is a choice operation, cancel every operation but the -one at @var{index}." - (match op - (($ base-ops) - (let loop ((i 0)) - (when (< i (vector-length base-ops)) - (unless (= i index) - (match (vector-ref base-ops i) - (($ wrap-fn try-fn block-fn cancel-fn) - (cancel-fn (current-scheduler)))))))))) - (define (perform-operation op) "Perform the operation @var{op} and return the resulting values. If the operation cannot complete directly, block until it can complete." @@ -169,10 +141,7 @@ the operation cannot complete directly, block until it can complete." (when (< i (vector-length base-ops)) (match (vector-ref base-ops i) (($ wrap-fn try-fn block-fn) - (let ((resume (lambda (thunk) - (cancel-other-operations op i) - (resume thunk)))) - (block-fn flag sched (wrap-resume resume wrap-fn))))) + (block-fn flag sched (wrap-resume resume wrap-fn)))) (lp (1+ i)))))))) (define (suspend)