nevalang / neva

🌊 Dataflow programming language with static types and implicit parallelism. Compiles to native code and Go
https://nevalang.org
MIT License
85 stars 7 forks source link

Lock: Add lock mechanism with array of input sigs #611

Open Catya3 opened 1 month ago

Catya3 commented 1 month ago

Name TBD

This is used when you have multiple sig and you want to wait on all of them to do something. A very common scenario.

:start -> (0 -> polyLock:data)
0 -> println -> polyLock:sig[0]
1 -> println -> polyLock:sig[1]
2 -> println -> polyLock:sig[2]
polyLock -> :stop
emil14 commented 1 month ago

A very common scenario

  1. If that's the case, please add some examples :)
  2. What do you think about updating Lock instead of adding new component?
  3. About having this in a separate package e.g. sync.PolyLock?
  4. About name like WaitGroup? People familiar with go immediately understand what is this. Especially if it's gonna be sync.WaitGroup
emil14 commented 1 month ago

We decided to create sync package

emil14 commented 1 month ago

BTW other names could be LockAll or LockMany