Add types for call-with-semaphore
This commit is contained in:
parent
42d841ce11
commit
e85cc55f6f
|
@ -1390,8 +1390,18 @@
|
|||
[semaphore-wait/enable-break (-> -Semaphore -Void)]
|
||||
[semaphore-peek-evt (-> -Semaphore (-mu x (-evt x)))]
|
||||
[semaphore-peek-evt? (asym-pred Univ B (-FS (-filter (-mu x (-evt x)) 0) -top))]
|
||||
;[call-with-semaphore ???]
|
||||
;[call-with-semaphore/enable-break ???]
|
||||
[call-with-semaphore
|
||||
(-polydots (b a)
|
||||
(cl->* (->... (list -Semaphore (->... '() [a a] b))
|
||||
[a a] b)
|
||||
(->... (list -Semaphore (->... '() [a a] b) (-opt (-> b)))
|
||||
[a a] b)))]
|
||||
[call-with-semaphore/enable-break
|
||||
(-polydots (b a)
|
||||
(cl->* (->... (list -Semaphore (->... '() [a a] b))
|
||||
[a a] b)
|
||||
(->... (list -Semaphore (->... '() [a a] b) (-opt (-> b)))
|
||||
[a a] b)))]
|
||||
|
||||
;; Section 11.3.1 (Thread Cells)
|
||||
[thread-cell? (make-pred-ty (make-ThreadCellTop))]
|
||||
|
|
|
@ -1840,6 +1840,20 @@
|
|||
(tc-e (make-semaphore) -Semaphore)
|
||||
(tc-e (let: ((s : Semaphore (make-semaphore 3)))
|
||||
(semaphore-post s)) -Void)
|
||||
[tc-e (call-with-semaphore (make-semaphore)
|
||||
(lambda: ([x : String]) (void))
|
||||
(lambda: () "x")
|
||||
"a")
|
||||
(t:Un -String -Void)]
|
||||
[tc-err (call-with-semaphore (make-semaphore)
|
||||
(lambda: ([x : String]) (void)))]
|
||||
[tc-err (call-with-semaphore (make-semaphore)
|
||||
(lambda: ([x : String]) (void))
|
||||
#f 'x)]
|
||||
[tc-err (call-with-semaphore (make-semaphore)
|
||||
(lambda: ([x : String]) (void))
|
||||
'not-a-failure-thunk
|
||||
"x")]
|
||||
|
||||
;Random Numbers
|
||||
(tc-e (make-pseudo-random-generator) -Pseudo-Random-Generator)
|
||||
|
|
Loading…
Reference in New Issue
Block a user