Re: add support for slists
And one more... "Damjan Jovanovic" <damjan.jov(a)gmail.com> wrote:
+__int64 interlocked_cmpxchg64( __int64 **dest, __int64 *xchg, __int64 *compare ) +{ + _lwp_mutex_lock( &interlocked_mutex ); + if (memcmp(*dest, compare, 8) == 0) + memcpy(*dest, xchg, 8); + else + memcpy(compare, *dest); + _lwp_mutex_unlock( &interlocked_mutex ); + return compare; +}
Is there any particular reason that you use memcmp/memcpy instead of directly manipulating 64-bit values? -- Dmitry.
Dmitry Timoshkov wrote:
And one more...
"Damjan Jovanovic" <damjan.jov(a)gmail.com> wrote:
+__int64 interlocked_cmpxchg64( __int64 **dest, __int64 *xchg, __int64 *compare ) +{ + _lwp_mutex_lock( &interlocked_mutex ); + if (memcmp(*dest, compare, 8) == 0) + memcpy(*dest, xchg, 8); + else + memcpy(compare, *dest); + _lwp_mutex_unlock( &interlocked_mutex ); + return compare; +}
Is there any particular reason that you use memcmp/memcpy instead of directly manipulating 64-bit values?
also, compare is a pointer to __int64 but the return type is __int64. Doesn't gcc complain about that? tom
participants (2)
-
Dmitry Timoshkov -
Tomas Carnecky