
I was reading the shared_ptr and shared_count classes and noticed that a mutex is used when it appears that atomic inc/dec could be used instead. Unless I am missing something? The atomic operations would be far better in terms of resource usage. It seems (to me anyway) far too expensive to have a mutex allocated for every object under management. On platforms where atomic inc/dec don't exist (if there are any<g>), a pool of mutexes be used. The object's pointer would be hashed to produce the appropriate mutex, thereby ensuring a consistent mutex for each object and a low likelihood of undesired contention. Also, an upper bound on the number of mutexes allocated vs. objects. Best, Don PS: This is now only my 2nd post, so if I am not following proper protocol, please feel free to advise. __________________________________ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250