2 Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 ===================================================================
32 ===================================================================
40 void MutexLock (mutex_t *m)
42 CRITICAL_SECTION *crit;
46 crit = (CRITICAL_SECTION *) m;
47 EnterCriticalSection (crit);
50 void MutexUnlock (mutex_t *m)
52 CRITICAL_SECTION *crit;
56 crit = (CRITICAL_SECTION *) m;
57 LeaveCriticalSection (crit);
60 mutex_t *MutexAlloc(void)
62 CRITICAL_SECTION *crit;
66 crit = (CRITICAL_SECTION *) safe_malloc(sizeof(CRITICAL_SECTION));
67 InitializeCriticalSection (crit);
74 ===================================================================
78 ===================================================================
86 void MutexLock (mutex_t *m)
88 pthread_mutex_t *my_mutex;
92 my_mutex = (pthread_mutex_t *) m;
93 pthread_mutex_lock (my_mutex);
96 void MutexUnlock (mutex_t *m)
98 pthread_mutex_t *my_mutex;
102 my_mutex = (pthread_mutex_t *) m;
103 pthread_mutex_unlock (my_mutex);
106 mutex_t *MutexAlloc(void)
108 pthread_mutex_t *my_mutex;
109 pthread_mutexattr_t mattrib;
113 my_mutex = safe_malloc (sizeof(*my_mutex));
114 if (pthread_mutexattr_create (&mattrib) == -1)
115 Error ("pthread_mutex_attr_create failed");
116 if (pthread_mutexattr_setkind_np (&mattrib, MUTEX_FAST_NP) == -1)
117 Error ("pthread_mutexattr_setkind_np failed");
118 if (pthread_mutex_init (my_mutex, mattrib) == -1)
119 Error ("pthread_mutex_init failed");
120 return (void *) my_mutex;
126 ===================================================================
130 ===================================================================
137 #include <abi_mutex.h>
138 #include <sys/types.h>
139 #include <sys/prctl.h>
141 void MutexLock (mutex_t *m)
147 lck = (abilock_t *) m;
151 void MutexUnlock (mutex_t *m)
157 lck = (abilock_t *) m;
161 mutex_t *MutexAlloc(void)
167 lck = (abilock_t *) safe_malloc(sizeof(abilock_t));
175 =======================================================================
179 =======================================================================
184 void MutexLock (mutex_t *m)
188 void MutexUnlock (mutex_t *m)
192 mutex_t *MutexAlloc(void)