Are APIs of GHashTable multi-thread safe ?



Hi all,

I'm studying some code snips of ghash.c (glib-2.20.1), and see the commet block in the beginning of ghash.c said it is MT safe, but some code seems not MT safe, e.g
  g_hash_table_remove ->(calls) g_hash_table_remove_internal -> g_hash_table_remove_node
 
in the function g_hash_table_remove_node, line 344:
  hash_table->nnodes--, ( not a atomic operation or protect by lock )


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]