Concurrency

From Adam Colton
Revision as of 12:24, 23 September 2019 by Adamcolton (talk | contribs) (Created page with "== Concurrency == Like Go, any function can be executed concurrently. go foo() However, Go tends to rely on channels for syncronization. I'd like to allow return values a ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Concurrency

Like Go, any function can be executed concurrently.

 go foo()

However, Go tends to rely on channels for syncronization. I'd like to allow return values

 a := go foo(1)
 b := go foo(2)
 c := go foo(3)
 return a+b+c

This will wait for all three to return before running "a+b+c".

Wait

A thread can wait for some condition. The condition must be an immutable action.

 wait(x == 20)