Restrict session to IP 

Locks on Threading Problem Solved

Global Rank: 238
Totalscore: 86234
Posts: 1456
Thanks: 1268
UpVotes: 788
Registered: 13y 348d

Last Seen: 2d 14h
The User is Offline
Locks on Threading Problem Solved
Google/translate0Thank You!0Good Post!0Bad Post! link
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.
tunelko, TheHiveMind, Z, balicocat, Ge0, samuraiblanco, arraez, jcquinterov, hophuocthinh, alfamen2, burhanudinn123, Ben_Dover, stephanduran89, braddie0 have subscribed to this thread and receive emails on new posts.
1 people are watching the thread at the moment.
This thread has been viewed 706 times.