Multi-threading
Quoted 5 lines · In article <[email protected]> Brad Pepers wrote:
There was a message posted by Jim Starkey about his experiences using threads on Linux and the problems debugging them. It came down to two things:
2. Linux is missing an atomic use-count mechanism which returns values like the Microsoft InterlockedIncrement/Decrement functions do.
Can't this be done using atomic_dec_and_test() and the likes ? Google tells me that windoze InterlockedIncrement/Decrement stuff does the almost same thing. Why can't refcounting be implemented using just atomic_inc/dec and/or atomic_inc/dec_and_test ?
Thanks
Signature · 2 lines
Dipankar Sarma <[email protected]> http://lse.sourceforge.net Linux Technology Center, IBM Software Lab, Bangalore, India.
Quoted 1 line · Dipankar Sarma
In article <[email protected]> Brad Pepers
Quoted 11 lines · wrote:
Quoted 6 lines
There was a message posted by Jim Starkey about his experiences using threads on Linux and the problems debugging them. It came down to two things:
2. Linux is missing an atomic use-count mechanism which returns values like the Microsoft InterlockedIncrement/Decrement functions do.
Can't this be done using
atomic_dec_and_test()and the likes ? Google tells me that windoze InterlockedIncrement/Decrement stuff does the almost same thing. Why can't refcounting be implemented using just atomic_inc/dec and/or atomic_inc/dec_and_test ?
The atomic_dec_and_test certainly handles the most often used case and is good enough. Apparently it would be nice to have the value back sometimes too though.
The atomic_inc_and_test is not much good though since the case you most often want to track is the 0 to 1 transition and not -1 to 0!
Signature · 2 lines
Brad Pepers [email protected]