summaryrefslogtreecommitdiff
path: root/fibers/conditions.scm
diff options
context:
space:
mode:
Diffstat (limited to 'fibers/conditions.scm')
-rw-r--r--fibers/conditions.scm30
1 files changed, 1 insertions, 29 deletions
diff --git a/fibers/conditions.scm b/fibers/conditions.scm
index 0183107..cae5086 100644
--- a/fibers/conditions.scm
+++ b/fibers/conditions.scm
@@ -33,6 +33,7 @@
#:use-module (ice-9 atomic)
#:use-module (ice-9 match)
#:use-module (fibers stack)
+ #:use-module (fibers counter)
#:use-module (fibers operations)
#:export (make-condition
condition?
@@ -40,35 +41,6 @@
wait-operation
wait))
-
-;;; Counter utilities
-;;;
-;;; Counters here are an atomic box containing an integer which are
-;;; either decremented or reset.
-
-;; How many times we run the block-fn until we gc
-(define %steps-till-gc 42) ; haven't tried testing for the most efficient number
-
-(define (make-counter)
- (make-atomic-box %steps-till-gc))
-
-(define (counter-decrement! counter)
- "Decrement integer in atomic box COUNTER."
- (let spin ((x (atomic-box-ref counter)))
- (let* ((x-new (1- x))
- (x* (atomic-box-compare-and-swap! counter x x-new)))
- (if (= x* x) ; successful decrement
- x-new
- (spin x*)))))
-
-(define (counter-reset! counter)
- "Reset a counter's contents."
- (atomic-box-set! counter %steps-till-gc))
-
-
-;;; Conditions
-
-
(define-record-type <condition>
(%make-condition signalled? waiters gc-step)
condition?