So you want to introduce threading to your application but locks cost more time than they could save?
Here is an easy solution:
Assume you want to count something with 3 threads.
Just make 3 copies of the var, and every thread works on his own exclusive copy.
to get the real value, simply sum the 3 vars and you get a valid answer. it might be outdated, but never wrong and in a messed up state. This way you can write lock-free threading for some use-cases.
- gizmore
The geeks shall inherit the properties and methods of object earth.