[commit: ghc] master: Fix hs_try_putmvar003 (#12800) (91f9e13)

git at git.haskell.org git at git.haskell.org
Mon Nov 7 08:38:09 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/91f9e13887f49c28e4dbde4edc2c5c65de44c9e9/ghc

>---------------------------------------------------------------

commit 91f9e13887f49c28e4dbde4edc2c5c65de44c9e9
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Fri Nov 4 14:10:39 2016 -0700

    Fix hs_try_putmvar003 (#12800)
    
    Summary:
    There was a race condition on some shared data when creating the
    callback thread.
    
    I couldn't repro the issue without inserting a dummy usleep(100), but
    it's definitely a bug.
    
    Test Plan: validate
    
    Reviewers: bgamari, austin, erikd
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2678
    
    GHC Trac Issues: #12800


>---------------------------------------------------------------

91f9e13887f49c28e4dbde4edc2c5c65de44c9e9
 testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c b/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c
index c499b72..aa65144 100644
--- a/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c
+++ b/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c
@@ -54,9 +54,9 @@ struct callback_queue* mkCallbackQueue(int use_foreign_export)
     pthread_t t;
     pthread_mutex_init(&q->lock, NULL);
     pthread_cond_init(&q->cond, NULL);
-    pthread_create(&t, NULL, (threadfunc*)callback, q);
     q->pending = NULL;
     q->use_foreign_export = use_foreign_export;
+    pthread_create(&t, NULL, (threadfunc*)callback, q);
     return q;
 }
 



More information about the ghc-commits mailing list