Could you show an example where two treads are generating some output in parallel that are being stored somewhere by the main tread? Eg. divide some computation onto different treads and combining the result?
Is it possible to share read-only references to some data with a thread? For example, you've read some data from a file, and then want to use multiple threads to process that same data in different ways.
Concurrently doesn’t necessarily mean at same time or in parallel, and the 2 threads are sharing the same standard output. Can we have a more complex example where multi threading is really useful?
Even the doggo is interested into threading
Nice! Would love to see a deepdive into threading in Rust.
Subbed incase you ever make one:)
Could you show an example where two treads are generating some output in parallel that are being stored somewhere by the main tread? Eg. divide some computation onto different treads and combining the result?
Is it possible to share read-only references to some data with a thread? For example, you've read some data from a file, and then want to use multiple threads to process that same data in different ways.
Yes. The most obvious way would be to wrap the data in an Arc (atomically reference counted).
Concurrently doesn’t necessarily mean at same time or in parallel, and the 2 threads are sharing the same standard output.
Can we have a more complex example where multi threading is really useful?
In all Rust channels the examples are the same. OK, but could you please show the use cases of the threads?