3 * property-bag.c: Linearizable property bag.
6 * Rodrigo Kumpera (kumpera@gmail.com)
8 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
10 #include <mono/metadata/property-bag.h>
11 #include <mono/utils/atomic.h>
12 #include <mono/utils/mono-membar.h>
15 mono_property_bag_get (MonoPropertyBag *bag, int tag)
17 MonoPropertyBagItem *item;
19 for (item = bag->head; item && item->tag <= tag; item = item->next) {
27 mono_property_bag_add (MonoPropertyBag *bag, void *value)
29 MonoPropertyBagItem *cur, **prev, *item = value;
31 mono_memory_barrier (); //publish the values in value
37 if (!cur || cur->tag > tag) {
39 if (InterlockedCompareExchangePointer ((void*)prev, item, cur) == cur)
42 } else if (cur->tag == tag) {