summaryrefslogtreecommitdiff
path: root/mutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'mutex.c')
-rw-r--r--mutex.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/mutex.c b/mutex.c
index 49a1a18..be039ac 100644
--- a/mutex.c
+++ b/mutex.c
@@ -93,14 +93,6 @@ pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
return EINVAL;
}
- mx = (pthread_mutex_t) calloc(1, sizeof(*mx));
-
- if (mx == NULL)
- {
- result = ENOMEM;
- goto FAIL0;
- }
-
if (attr != NULL
&& *attr != NULL
&& (*attr)->pshared == PTHREAD_PROCESS_SHARED
@@ -118,16 +110,22 @@ pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
#error ERROR [__FILE__, line __LINE__]: Process shared mutexes are not supported yet.
-
#else
- result = ENOSYS;
- goto FAIL0;
+ return ENOSYS;
#endif /* _POSIX_THREAD_PROCESS_SHARED */
}
+ mx = (pthread_mutex_t) calloc(1, sizeof(*mx));
+
+ if (mx == NULL)
+ {
+ result = ENOMEM;
+ goto FAIL0;
+ }
+
mx->lock_idx = PTW32_MUTEX_LOCK_IDX_INIT;
mx->recursive_count = 0;
mx->kind = (attr == NULL || *attr == NULL