diff options
author | Christopher Baines <mail@cbaines.net> | 2024-06-07 11:20:39 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-06-07 12:05:25 +0100 |
commit | 3452b682c3a2d33a13818b6a137e7540a3f1bbe9 (patch) | |
tree | 650036525cc222a53cd0823cf4839dc5d874e892 /guix-build-coordinator/utils | |
parent | 846aa141c8393ccb74e65c0160eff36620955ef9 (diff) | |
download | build-coordinator-3452b682c3a2d33a13818b6a137e7540a3f1bbe9.tar build-coordinator-3452b682c3a2d33a13818b6a137e7540a3f1bbe9.tar.gz |
Avoid using select and use poll instead
I don't trust select, as I think I'm seeing it make blocking read calls. I
don't know if that's coming from here, but better to just avoid it.
Diffstat (limited to 'guix-build-coordinator/utils')
-rw-r--r-- | guix-build-coordinator/utils/fibers.scm | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/guix-build-coordinator/utils/fibers.scm b/guix-build-coordinator/utils/fibers.scm index 293429c..2c7307f 100644 --- a/guix-build-coordinator/utils/fibers.scm +++ b/guix-build-coordinator/utils/fibers.scm @@ -447,20 +447,16 @@ If already in the worker thread, call PROC immediately." (define (readable? port) "Test if PORT is writable." - (match (select (vector port) #() #() 0) - ((#() #() #()) #f) - ((#(_) #() #()) #t))) + (= 1 (port-poll port "r" 0))) (define (writable? port) "Test if PORT is writable." - (match (select #() (vector port) #() 0) - ((#() #() #()) #f) - ((#() #(_) #()) #t))) + (= 1 (port-poll port "w" 0))) (define (make-wait-operation ready? schedule-when-ready port port-ready-fd this-procedure) (make-base-operation #f (lambda _ - (and (ready? (port-ready-fd port)) values)) + (and (ready? port) values)) (lambda (flag sched resume) (define (commit) (match (atomic-box-compare-and-swap! flag 'W 'S) |