MAJOR: threads/buffer: Make buffer wait queue thread safe

Adds a global lock to protect the buffer wait queue.
diff --git a/include/proto/applet.h b/include/proto/applet.h
index d9f0ce2..766fc92 100644
--- a/include/proto/applet.h
+++ b/include/proto/applet.h
@@ -88,8 +88,10 @@
 	}
 
 	if (!LIST_ISEMPTY(&appctx->buffer_wait.list)) {
+		SPIN_LOCK(BUF_WQ_LOCK, &buffer_wq_lock);
 		LIST_DEL(&appctx->buffer_wait.list);
 		LIST_INIT(&appctx->buffer_wait.list);
+		SPIN_UNLOCK(BUF_WQ_LOCK, &buffer_wq_lock);
 	}
 
 	pool_free2(pool2_connection, appctx);