You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
there are several threads concurrently writing on a same value in the hashmap,so i need "update_fn" rather than "update" to lock the value to avoid overwriting.
my input function seems like void fn(mapped_type&, param1 xx, param2 xx ....)
i need more extra input params, but the update_fn may not supported.
can u give me some advices to solve this problem?
The text was updated successfully, but these errors were encountered:
Hi @arjen-Lee1993. update_fn can only provide mapped_type&, as that is the only information stored in the hashtable. If the additional parameters are coming from somewhere else, maybe they can be captured by the lambda you provide to update_fn? E.g.
map.update_fn(k, [¶m1, ¶m2, &fn](mapped_type& m) { fn(m, param1, param2); });
there are several threads concurrently writing on a same value in the hashmap,so i need "update_fn" rather than "update" to lock the value to avoid overwriting.
my input function seems like void fn(mapped_type&, param1 xx, param2 xx ....)
i need more extra input params, but the update_fn may not supported.
can u give me some advices to solve this problem?
The text was updated successfully, but these errors were encountered: