| 1 | /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB |
| 2 | 2016 MariaDB Corporation AB |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Library General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2 of the License, or (at your option) any later version. |
| 8 | |
| 9 | This library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Library General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Library General Public |
| 15 | License along with this library; if not, write to the Free |
| 16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 17 | MA 02111-1301, USA */ |
| 18 | |
| 19 | /* Defines to make different thread packages compatible */ |
| 20 | |
| 21 | #ifndef _my_pthread_h |
| 22 | #define _my_pthread_h |
| 23 | |
| 24 | #if defined(_WIN32) |
| 25 | #include <windows.h> |
| 26 | typedef CRITICAL_SECTION pthread_mutex_t; |
| 27 | #define pthread_mutex_init(A,B) InitializeCriticalSection(A) |
| 28 | #define pthread_mutex_lock(A) (EnterCriticalSection(A),0) |
| 29 | #define pthread_mutex_unlock(A) LeaveCriticalSection(A) |
| 30 | #define pthread_mutex_destroy(A) DeleteCriticalSection(A) |
| 31 | #define pthread_self() GetCurrentThreadId() |
| 32 | #endif /* defined(_WIN32) */ |
| 33 | |
| 34 | #endif /* _my_ptread_h */ |
| 35 | |