@[EntryPoint]
activity Main ()()
var i: nat8 = 42
cobegin
await true
i = 5 // A
with
i = i + 1 // B
end
end
Hallo Matthias,
indeed this program must be rejected and this is a deliberate choice. We take a “thread local” view (cf. https://github.com/boschresearch/blech-doc/blob/master/documentation/blech-user-manual/controlflow.adoc#causality) which means there are two threads that both want to write variable i. The exact reaction is irrelevant. Of course, this is an over-approximation in this particular case. But in general these write operations may come after await statements with different conditions and the compiler cannot guarantee that they exclude one another.
Note that your example is a sequential program in nature. It would be interesting to see if you can find a practical example in which
- concurrency is needed
- writing from at least two threads to a shared variable is needed
- you can statically determine that these writes do not interfere
Given such an example, we could discuss if we can find patterns how to rewrite it in Blech.
Cheers,
Friedrich
--
You received this message because you are subscribed to the Google Groups "blech-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
blech-lang+...@googlegroups.com.
To view this discussion on the web, visit
https://groups.google.com/d/msgid/blech-lang/f7c6c5df-2287-4996-948f-26e22da14b64%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to blech-lang+unsubscribe@googlegroups.com.
That’s right J
Best,
To unsubscribe from this group and stop receiving emails from it, send an email to blech-lang+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/blech-lang/f7c6c5df-2287-4996-948f-26e22da14b64%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "blech-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
blech-lang+...@googlegroups.com.
To view this discussion on the web, visit
https://groups.google.com/d/msgid/blech-lang/928dfa5f-3fb3-4b00-a613-a5e13c5e3f64%40googlegroups.com.