ta0kira / zeolite

Zeolite is a statically-typed, general-purpose programming language.
Apache License 2.0
18 stars 0 forks source link

Add barrier support to `lib/thread`. #143

Closed ta0kira closed 3 years ago

ta0kira commented 3 years ago

There is a high risk of deadlocks with pthread_barrier_wait because it requires an exact number of threads to wait before any of them can continue.

So, I'm not sure if I want to implement this. If that sort of parallelization is needed, perhaps that should be fully encapsulated in a C++ extension that divides up work in a particular manner.

The only situation I recall using a barrier in was to wait for all processing threads to be ready prior to reading very large amounts of data from disk for the next block of processing. So, it definitely has its uses, but I don't know if that sort of use-case will be common in Zeolite code.


Perhaps there's a way to make it less prone to deadlocks.

For example: