并发套件哈希 table 和多个编写器
Concurrency Kit hash table and multiple writers
在 Concurrency Kit 文档中,我在 get
和 put
操作中看到 SPMC:
ck_ht_get_spmc()
ck_ht_put_spmc()
这是否意味着我不能将此哈希 table 用于多个作者,并且我会有竞争条件?
目前我使用带有 put
操作的互斥锁来使其像单个写入器一样工作。
是的,来自 ck_ht_init
的文档:
The hash table is safe to access by multiple readers in the presence of one concurrent writer. Behavior is undefined in the presence of concurrent writers.
在 Concurrency Kit 文档中,我在 get
和 put
操作中看到 SPMC:
ck_ht_get_spmc()
ck_ht_put_spmc()
这是否意味着我不能将此哈希 table 用于多个作者,并且我会有竞争条件?
目前我使用带有 put
操作的互斥锁来使其像单个写入器一样工作。
是的,来自 ck_ht_init
的文档:
The hash table is safe to access by multiple readers in the presence of one concurrent writer. Behavior is undefined in the presence of concurrent writers.