mutex.c (apr-1.6.5.tar.bz2) | : | mutex.c (apr-1.7.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | |||
* | * | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | |||
* limitations under the License. | * limitations under the License. | |||
*/ | */ | |||
#include "apr_arch_atomic.h" | #include "apr_arch_atomic.h" | |||
#include "apr_thread_mutex.h" | ||||
#ifdef USE_ATOMICS_GENERIC | #ifdef USE_ATOMICS_GENERIC | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#if APR_HAS_THREADS | #if APR_HAS_THREADS | |||
# define DECLARE_MUTEX_LOCKED(name, mem) \ | # define DECLARE_MUTEX_LOCKED(name, mem) \ | |||
apr_thread_mutex_t *name = mutex_hash(mem) | apr_thread_mutex_t *name = mutex_hash(mem) | |||
# define MUTEX_UNLOCK(name) \ | # define MUTEX_UNLOCK(name) \ | |||
do { \ | do { \ | |||
skipping to change at line 73 | skipping to change at line 74 | |||
apr_pool_cleanup_null); | apr_pool_cleanup_null); | |||
for (i = 0; i < NUM_ATOMIC_HASH; i++) { | for (i = 0; i < NUM_ATOMIC_HASH; i++) { | |||
rv = apr_thread_mutex_create(&(hash_mutex[i]), | rv = apr_thread_mutex_create(&(hash_mutex[i]), | |||
APR_THREAD_MUTEX_DEFAULT, p); | APR_THREAD_MUTEX_DEFAULT, p); | |||
if (rv != APR_SUCCESS) { | if (rv != APR_SUCCESS) { | |||
return rv; | return rv; | |||
} | } | |||
} | } | |||
return APR_SUCCESS; | return apr__atomic_generic64_init(p); | |||
} | } | |||
static APR_INLINE apr_thread_mutex_t *mutex_hash(volatile apr_uint32_t *mem) | static APR_INLINE apr_thread_mutex_t *mutex_hash(volatile apr_uint32_t *mem) | |||
{ | { | |||
apr_thread_mutex_t *mutex = hash_mutex[ATOMIC_HASH(mem)]; | apr_thread_mutex_t *mutex = hash_mutex[ATOMIC_HASH(mem)]; | |||
if (apr_thread_mutex_lock(mutex) != APR_SUCCESS) { | if (apr_thread_mutex_lock(mutex) != APR_SUCCESS) { | |||
abort(); | abort(); | |||
} | } | |||
return mutex; | return mutex; | |||
} | } | |||
#else | #else | |||
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p) | APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p) | |||
{ | { | |||
return APR_SUCCESS; | return apr__atomic_generic64_init(p); | |||
} | } | |||
#endif /* APR_HAS_THREADS */ | #endif /* APR_HAS_THREADS */ | |||
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem) | APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem) | |||
{ | { | |||
return *mem; | return *mem; | |||
} | } | |||
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) | APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added |