[4.1] 5fd309e Barriers can only be created on the top thread

Lasse Karstensen lkarsten at varnish-software.com
Tue Jun 14 11:19:08 CEST 2016


commit 5fd309eccc40eeef8df0d4ca798284ae536d89d8
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