Add emplace support for concurrent.

This commit is contained in:
Patrick Pelissier committed 2022-10-10 23:08:30 +02:00
1 parent 64800dbd3f
commit b82670b643
2 files changed
+15

No files matched your search

+2
View File
@@ -515,6 +515,8 @@
M_C(name, _write_signal)(out); \
M_C(name, _write_unlock)(out); \
} \
\
M_EMPLACE_QUEUE_DEF(name, concurrent_t, M_C(name, _emplace), M_GET_OPLIST oplist, M_EMPLACE_QUEUE_GENE) \
,) \
\
M_IF_METHOD(POP, oplist)( \
+13
View File
@@ -226,6 +226,18 @@ static void test_double(void)
ConcurrentRpDouble_clear(r);
}
static void test_emplace(void)
{
key_list_ts_t ts;
key_list_ts_init(ts);
key_list_ts_emplace(ts, "HELLO");
M_LET(s, string_t) {
key_list_ts_pop(&s, ts);
assert(string_equal_str_p(s, "HELLO"));
}
key_list_ts_clear(ts);
}
int main(void)
{
test_basic();
@@ -233,5 +245,6 @@ int main(void)
test_thread();
test_rp_thread();
test_double();
test_emplace();
exit(0);
}