[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: Blair Zajac <blair_at_orcaware.com>
Date: Sun, 15 Apr 2012 07:34:28 -0700

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?

Blair
Received on 2012-04-15 16:35:01 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.