[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Stefan Fuhrmann <stefanfuhrmann_at_alice-dsl.de>
Date: Sun, 15 Apr 2012 17:11:00 +0200

Am 15.04.2012 16:34, schrieb Blair Zajac:
> On 03/08/2012 01:18 PM, stefan2_at_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.
Received on 2012-04-15 19:11:36 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.