Changeset 3194 for trunk/src/kmk/w32/compat/posixfcn.c
- Timestamp:
- Mar 27, 2018, 4:05:17 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/w32/compat/posixfcn.c
r3140 r3194 154 154 record_sync_mutex (const char *str) 155 155 { 156 #ifdef CONFIG_NEW_WIN_CHILDREN 157 HANDLE hmtx = OpenMutexA(SYNCHRONIZE, FALSE /*fInheritable*/, str); 158 if (hmtx) 159 mutex_handle = (intptr_t)hmtx; 160 else 161 { 162 mutex_handle = -1; 163 errno = ENOENT; 164 } 165 #else 156 166 char *endp; 157 167 intptr_t hmutex = strtol (str, &endp, 16); … … 164 174 errno = EINVAL; 165 175 } 176 #endif 166 177 } 167 178 168 179 /* Create a new mutex or reuse one created by our parent. */ 169 180 intptr_t 181 #ifdef CONFIG_NEW_WIN_CHILDREN 182 create_mutex (char *mtxname, size_t size) 183 #else 170 184 create_mutex (void) 171 { 185 #endif 186 { 187 #ifndef CONFIG_NEW_WIN_CHILDREN 172 188 SECURITY_ATTRIBUTES secattr; 189 #endif 173 190 intptr_t hmutex = -1; 174 191 … … 176 193 that. */ 177 194 if (mutex_handle > 0) 178 return mutex_handle; 179 195 { 196 #ifdef CONFIG_NEW_WIN_CHILDREN 197 mtxname[0] = '\0'; 198 #endif 199 return mutex_handle; 200 } 201 202 #ifdef CONFIG_NEW_WIN_CHILDREN 203 /* We're the top-level Make. Child Make processes will open our mutex, since 204 children does not inherit any handles other than the three standard ones. */ 205 snprintf(mtxname, size, "Make-output-%u-%u-%u", GetCurrentProcessId(), 206 GetCurrentThreadId(), GetTickCount()); 207 hmutex = (intptr_t)CreateMutexA (NULL, FALSE /*Locked*/, mtxname); 208 #else 180 209 /* We are the top-level Make, and we want the handle to be inherited 181 210 by our child processes. */ … … 185 214 186 215 hmutex = (intptr_t)CreateMutex (&secattr, FALSE, NULL); 216 #endif 187 217 if (!hmutex) 188 218 {
Note:
See TracChangeset
for help on using the changeset viewer.