This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
analysis cannot tell that the mutex was locked
authorJarkko Hietaniemi <jhi@iki.fi>
Thu, 19 Nov 2015 02:25:04 +0000 (21:25 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Mon, 23 Nov 2015 11:55:12 +0000 (06:55 -0500)
It was locked in S_ithread_create() - in case it returned a non-NULL thread.
Because of this conditionality the S_ithread_create() cannot be annotated.

threads.xs:1161:9: warning: releasing mutex 'thread->mutex' that was not held [-Wthread-safety-analysis]
        MUTEX_UNLOCK(&thread->mutex);

dist/threads/threads.xs

index 9333a34..82a59bb 100644 (file)
@@ -1158,7 +1158,10 @@ ithread_create(...)
 
         /* Let thread run. */
         /* See S_ithread_run() for more detail. */
+       CLANG_DIAG_IGNORE(-Wthread-safety);
+       /* warning: releasing mutex 'thread->mutex' that was not held [-Wthread-safety-analysis] */
         MUTEX_UNLOCK(&thread->mutex);
+       CLANG_DIAG_RESTORE;
 
         /* XSRETURN(1); - implied */