/usr/share/scsh-0.6/big/placeholder.scm is in scsh-common-0.6 0.6.7-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ; Copyright (c) 1993-1999 by Richard Kelsey and Jonathan Rees. See file COPYING.
; Placeholders (single-assignment cells for use with threads)
(define-record-type placeholder :placeholder
(really-make-placeholder queue id)
placeholder?
(queue placeholder-queue set-placeholder-queue!) ; #f means VALUE has been set
(value placeholder-real-value set-placeholder-value!)
(id placeholder-id))
(define-record-discloser :placeholder
(lambda (placeholder)
(cons 'placeholder
(if (placeholder-id placeholder)
(list (placeholder-id placeholder))
'()))))
(define (make-placeholder . id-option)
(really-make-placeholder (make-queue)
(if (null? id-option) #f (car id-option))))
(define (placeholder-value placeholder)
(with-interrupts-inhibited
(lambda ()
(if (placeholder-queue placeholder)
(block-on-queue (placeholder-queue placeholder)))
(placeholder-real-value placeholder))))
(define (placeholder-set! placeholder value)
(let ((waiters (with-interrupts-inhibited
(lambda ()
(let ((queue (placeholder-queue placeholder)))
(cond (queue
(set-placeholder-value! placeholder value)
(set-placeholder-queue! placeholder #f)
(let loop ((waiters '()))
(cond
((maybe-dequeue-thread! queue)
=> (lambda (thread)
(loop (cons thread waiters))))
(else
waiters))))
(else #f)))))))
(if waiters
(for-each make-ready waiters)
(if (not (eq? value (placeholder-value placeholder)))
(error "placeholder is already assigned"
placeholder
value)))))
|