[master] 0899861 Barriers can only be created on the top thread

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Mar 29 14:20:05 CEST 2016


commit 0899861529ad56054f2cd76870863fe5b0a6dd96
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Dec 23 16:24:02 2015 +0100

    Barriers can only be created on the top thread
    
    This is similar ASSERT_CLI, in order to make socket barriers creation
    thread-safe.

diff --git a/bin/varnishtest/vtc_barrier.c b/bin/varnishtest/vtc_barrier.c
index b170c56..ba80cfb 100644
--- a/bin/varnishtest/vtc_barrier.c
+++ b/bin/varnishtest/vtc_barrier.c
@@ -70,6 +70,9 @@ barrier_new(char *name, struct vtclog *vl)
 	AN(name);
 	if (*name != 'b')
 		vtc_log(vl, 0, "Barrier name must start with 'b' (%s)", name);
+	if (pthread_self() != vtc_thread)
+		vtc_log(vl, 0,
+		    "Barrier %s can only be created on the top thread", name);
 	REPLACE(b->name, name);
 
 	AZ(pthread_mutex_init(&b->mtx, NULL));



More information about the varnish-commit mailing list