apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wchang0...@aol.com (Wan-Teh Chang)
Subject Re: request for comments: new atomic API
Date Sat, 13 Sep 2003 14:29:59 GMT
1. It seems that you intentionally do not want the add32, sub32,
and inc32 return a value.  Only the dec32 function returns a
value, and that value can only be used as a boolean (zero or
nonzero).

2. There is no atomic exchange function that atomically sets
the new value and returns the old value.  (This can be implemented
with the cas32 function in your API, so people can work around the
lack of the atomic exchange function.)

3. Providing cas32 is risky.  It tempts people to build lock-free
data structures with it, but the necessary memory barriers are
difficult to use right, and few people even realize that memory
barriers are necessary on some multiprocessor systems.

Wan-Teh


Mime
View raw message