Posts: 22

Thread safety

I've just read the blog article about Spatial's view on thread safety.

The limitations with Spatial's model that are mentioned (initialization for every thread and different history streams) may require operations that are time consuming enough to defeat the whole purpose. For no good reason, different history streams are required also for read-only operations.

The truth is that your conservative decisions have brought you even further away from industrial strength programming principles.

Since five years there is an ISO-standard memory model. Const correctness now also means thread safe, which you still ignore and break.

Also, you don't seem to realize one of the most important features of any API - that is composability! Based on your API, we would like to be able to write our own parallel algorithms, task systems, futures with continuations, etc.

But no, to avoid data races we have to be extremely careful to not combine any Spatial functions along the chain of calls to other thread/multicore libraries. For example: parallel_for, parallel_invoke, async, future, packaged_task. With C++17 there are also some new parallel versions of STL algorithms. And there will be more, this is just the beginning.

That's where you should look forward!