libnm: make ref counting of immutable types thread safe

The types NMBridgeVlan, NMIPRoutingRule, NMRange, NMWireGuardPeer
are immutable (or immutable after the seal() function is called).

Immutable types are great, as it means a reference to them can be shared
without doing a full clone. Hence the G_DEFINE_BOXED_TYPE() of these
types prefers to take a reference instead of cloning the objects. Except
for sealable types, it will still prefer to clone an unsealed value.
Likewise, nm_simple_connection_new_clone() probably will just take
another reference to the value, instead of doing a deep clone.

libnm is not a thread-safe library in the sense that you could pass a
NMConnection or NMClient instance to multiple threads and access them
without your own synchronization. However, it should be possible that
multiple threads access distinct objects.

As the copy function of these types (and nm_simple_connection_new_clone()
and similar) prefers to take a reference, it is important that the ref
function is thread-safe too. Otherwise you cannot just clone a NMConnection
on thread1, hand the clone to thread2 and operate on them independently.
If you do that, you hit a subtle bug.

Avoid that. While atomic operations have a runtime overhead, being safe
is more important. Also, we already safe a full malloc()/free() by
having immutable, ref-counted types. We just need to make it safe to use
it to fully benefit from it.
61 jobs for th/ovs-port-verify-without-hash in 34 minutes and 48 seconds (queued for 6 seconds)