Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * Project: PROJ.4 |
3 | | * Purpose: Mutex (thread lock) functions. |
4 | | * Author: Frank Warmerdam, warmerdam@pobox.com |
5 | | * |
6 | | ****************************************************************************** |
7 | | * Copyright (c) 2009, Frank Warmerdam |
8 | | * |
9 | | * Permission is hereby granted, free of charge, to any person obtaining a |
10 | | * copy of this software and associated documentation files (the "Software"), |
11 | | * to deal in the Software without restriction, including without limitation |
12 | | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
13 | | * and/or sell copies of the Software, and to permit persons to whom the |
14 | | * Software is furnished to do so, subject to the following conditions: |
15 | | * |
16 | | * The above copyright notice and this permission notice shall be included |
17 | | * in all copies or substantial portions of the Software. |
18 | | * |
19 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
20 | | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
22 | | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
24 | | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
25 | | * DEALINGS IN THE SOFTWARE. |
26 | | *****************************************************************************/ |
27 | | |
28 | | #include <mutex> |
29 | | |
30 | | #include "proj.h" |
31 | | #include "proj_internal.h" |
32 | | |
33 | | static std::recursive_mutex core_lock; |
34 | | |
35 | | /************************************************************************/ |
36 | | /* pj_acquire_lock() */ |
37 | | /* */ |
38 | | /* Acquire the PROJ.4 lock. */ |
39 | | /************************************************************************/ |
40 | | |
41 | 1.89k | void pj_acquire_lock() { core_lock.lock(); } |
42 | | |
43 | | /************************************************************************/ |
44 | | /* pj_release_lock() */ |
45 | | /* */ |
46 | | /* Release the PROJ.4 lock. */ |
47 | | /************************************************************************/ |
48 | | |
49 | 1.89k | void pj_release_lock() { core_lock.unlock(); } |