Created
April 4, 2014 05:41
-
-
Save kencoba/9968788 to your computer and use it in GitHub Desktop.
[SyncStitch]Deadlock ref: http://qiita.com/kencoba/items/ef987a96cdd254fa17fc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Definitions | |
(define-channel rch (x) '((0) (1))) | |
(define-channel sch (x) '((0) (1))) | |
; Receiver | |
(define-process Receiver | |
(? rch (x) (= x 0) (! sch (0) Receiver))) | |
; Sender : Deadlockの例1 SenderもReceiverもメッセージ受信待ち | |
(define-process Sender | |
(? sch (x) (= x 0) (! rch (0) Sender))) | |
; Sender : Deadlockの例2 Receriverは0を送信するが、Senderは1が来るまで待ち | |
(define-process Sender | |
(! rch (0) (? sch (x) (= x 1) Sender))) | |
; SYS | |
(define-process SYS | |
(par (list rch sch) Receiver Sender)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment