Don't run test-318 with gmcs.
[mono.git] / mono / io-layer / mono-mutex.c
index bfbfd9bee4fbca238d8d58750463b1dbc06e8525..104c36b46fccfcb2990172a26973adb034123222 100644 (file)
@@ -304,7 +304,11 @@ mono_mutex_unlock (mono_mutex_t *mutex)
                if (pthread_mutex_lock (&mutex->mutex) != 0)
                        return EINVAL;
                
-               assert (mutex->owner == pthread_self ());
+               if (mutex->owner != pthread_self()) {
+                       /* Not owned by this thread */
+                       pthread_mutex_unlock (&mutex->mutex);
+                       return EPERM;
+               }
                
                mutex->depth--;
                if (mutex->depth == 0) {