2 * svn_mutex.c: routines for mutual exclusion.
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
21 * ====================================================================
24 #include "svn_private_config.h"
25 #include "private/svn_mutex.h"
28 svn_mutex__init(svn_mutex__t
**mutex_p
,
29 svn_boolean_t mutex_required
,
30 apr_pool_t
*result_pool
)
32 /* always initialize the mutex pointer, even though it is not
33 strictly necessary if APR_HAS_THREADS has not been set */
39 apr_thread_mutex_t
*apr_mutex
;
41 apr_thread_mutex_create(&apr_mutex
,
42 APR_THREAD_MUTEX_DEFAULT
,
45 return svn_error_wrap_apr(status
, _("Can't create mutex"));
55 svn_mutex__lock(svn_mutex__t
*mutex
)
60 apr_status_t status
= apr_thread_mutex_lock(mutex
);
62 return svn_error_wrap_apr(status
, _("Can't lock mutex"));
70 svn_mutex__unlock(svn_mutex__t
*mutex
,
76 apr_status_t status
= apr_thread_mutex_unlock(mutex
);
78 return svn_error_wrap_apr(status
, _("Can't unlock mutex"));