diff --git a/m-concurrent.h b/m-concurrent.h index 335a7d3e..3cc80b0a 100644 --- a/m-concurrent.h +++ b/m-concurrent.h @@ -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)( \ diff --git a/tests/test-mconcurrent.c b/tests/test-mconcurrent.c index 835b752c..334d34c7 100644 --- a/tests/test-mconcurrent.c +++ b/tests/test-mconcurrent.c @@ -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); }