| 314 | } |
| 315 | |
| 316 | int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mattr) |
| 317 | { |
| 318 | const char *myname = "pthread_mutex_init"; |
| 319 | |
| 320 | if (mutex == NULL) { |
| 321 | msg_error("%s, %s(%d): input invalid", |
| 322 | __FILE__, myname, __LINE__); |
| 323 | return -1; |
| 324 | } |
| 325 | |
| 326 | mutex->dynamic = 0; |
| 327 | |
| 328 | /* Create the mutex, with initial value signaled */ |
| 329 | mutex->id = CreateMutex((SECURITY_ATTRIBUTES *) mattr, FALSE, NULL); |
| 330 | if (!mutex->id) { |
| 331 | msg_error("%s, %s(%d): CreateMutex error(%s)", |
| 332 | __FILE__, myname, __LINE__, last_serror()); |
| 333 | mem_free(mutex); |
| 334 | return -1; |
| 335 | } |
| 336 | |
| 337 | return 0; |
| 338 | } |
| 339 | |
| 340 | int pthread_mutex_lock(pthread_mutex_t *mutex) |
| 341 | { |
searching dependent graphs…