Synchronous concurrency: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 1,139: | Line 1,139: | ||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
\ synco.fs Synchronous concurrency for RosettaCode |
\ synco.fs Synchronous concurrency for RosettaCode |
||
include co.fs |
include co.fs |
||
Line 1,162: | Line 1,161: | ||
REPEAT DROP |
REPEAT DROP |
||
Line DUP CHAN 2! |
Line DUP CHAN 2! |
||
⚫ | |||
\ -- Wait for report back |
|||
BEGIN CO CHAN CHAN? UNTIL |
|||
\ -- Have it, show and go |
|||
CR S" -------" TYPE |
CR S" -------" TYPE |
||
CR S" LINES: " TYPE CHAN @ ? |
CR S" LINES: " TYPE CHAN @ ? |
||
Line 1,179: | Line 1,182: | ||
CO |
CO |
||
REPEAT |
REPEAT |
||
⚫ | |||
\ -- Chance to stop other writers |
|||
CO |
CO |
||
\ -- First of writers reports back |
|||
\ -- the shared global counter |
|||
CHAN CHAN? 0= |
|||
IF |
|||
⚫ | |||
⚫ | |||
THEN |
|||
; |
; |
||
\ |
\ |
||
\ * RUNNER |
\ * RUNNER |
||
\ |
\ |
||
READER WRITER GO CR BYE |
READER WRITER ( WRITER WRITER :-) GO CR BYE |
||
------- |
------- |
||
LINES: |
LINES: 59 |
||
</pre> |
</pre> |
||