Concurrency: Difference between revisions

From Adam Colton
Jump to navigation Jump to search
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 ..."
 
No edit summary
 
Line 12: Line 12:
A thread can wait for some condition. The condition must be an immutable action.
A thread can wait for some condition. The condition must be an immutable action.
   wait(x == 20)
   wait(x == 20)
== Priority ==
When starting a thread, it can have a priority. The catch is that most of the time we don't want this. So I think it's something that can be set on the runtime during compilation.


[[Category:Gryphon]]
[[Category:Gryphon]]

Latest revision as of 12:56, 23 September 2019

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)

Priority

When starting a thread, it can have a priority. The catch is that most of the time we don't want this. So I think it's something that can be set on the runtime during compilation.