subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Fuhrmann <stefanfuhrm...@alice-dsl.de>
Subject Re: svn commit: r1298587 - in /subversion/branches/revprop-cache: build.conf subversion/include/private/svn_named_atomic.h subversion/include/svn_error_codes.h subversion/libsvn_subr/svn_named_atomic.c
Date Sun, 15 Apr 2012 15:11:00 GMT
Am 15.04.2012 16:34, schrieb Blair Zajac:
> On 03/08/2012 01:18 PM, stefan2@apache.org wrote:
>> Author: stefan2
>> Date: Thu Mar  8 21:18:45 2012
>> New Revision: 1298587
>>
>> URL: http://svn.apache.org/viewvc?rev=1298587&view=rev
>> Log:
>> Define and implement svn_named_atomic__t and associated API.
>>
>> * subversion/include/private/svn_named_atomic.h
>>    new file, containing the new svn_named_atomic API
>> * subversion/libsvn_subr/svn_named_atomic.c
>>    new file, implements the new API
>> * subversion/include/svn_error_codes.h
>>    (SVN_ERR_BAD_ATOMIC): new error code used throughout the new API
>> * build.conf
>>    (libsvn_subr): add new header to exports
>>
>
>> +static apr_int64_t
>> +synched_add(volatile apr_int64_t *mem, apr_int64_t delta)
>> +{
>> +  return *mem += delta;
>> +}
>
> Is this thread safe?  Could the thread after reading *mem be context 
> switched out, another thread calls synced_add(), then the first thread 
> does its add and writes the *mem?

No those functions are only thread-safe in
combination with the SYNCHRONIZE macro
(see comment in source code).

-- Stefan^2.

Mime
View raw message