MEDIUM: threads/server: Add a lock per server and atomically update server vars

The server's lock is use, among other things, to lock acces to the active
connection list of a server.
diff --git a/include/proto/stream.h b/include/proto/stream.h
index 00f452c..aae7d34 100644
--- a/include/proto/stream.h
+++ b/include/proto/stream.h
@@ -262,17 +262,23 @@
 
 static void inline stream_add_srv_conn(struct stream *sess, struct server *srv)
 {
+	SPIN_LOCK(SERVER_LOCK, &srv->lock);
 	sess->srv_conn = srv;
 	LIST_ADD(&srv->actconns, &sess->by_srv);
+	SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
 }
 
 static void inline stream_del_srv_conn(struct stream *sess)
 {
-	if (!sess->srv_conn)
+	struct server *srv = sess->srv_conn;
+
+	if (!srv)
 		return;
 
+	SPIN_LOCK(SERVER_LOCK, &srv->lock);
 	sess->srv_conn = NULL;
 	LIST_DEL(&sess->by_srv);
+	SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
 }
 
 static void inline stream_init_srv_conn(struct stream *sess)