I want to execute multiple thread side by side.
ex: There will be a simple counter method, the thread will access the method and will print the counter value. One thread should not wait for another thread to stop before starting.
A sample output [maybe]:
T1 1
T2 1
T1 2
T1 3
T1 4
T2 2
T1 5
I’ve no prior idea on multi-threading and just want to learn.
If the counter is shared you want something like this:
Otherwise, if you want a per-thread counter: