Ho più thread che aggiungono, modificano e cercano i dati in GHashTable. È thread-safe o devo implementare personalmente me stesso?Il thread di GHashTable (glib2) è sicuro?
8
A
risposta
13
The documentation l'afferma abbastanza chiaramente:
Dopo aver chiamato
g_thread_init()
, GLib è completamente thread-safe (tutti i dati globali si blocca automaticamente), ma i singoli istanze di struttura dati non sono automaticamente bloccati per motivi di prestazioni. Quindi, ad esempio, è necessario coordinare gli accessi allo stessoGHashTable
da più thread.
Quindi: no, la tabella hash non è thread-safe.
Problemi correlati
- 1. Il thread libuv è sicuro?
- 2. Il thread NSPersistentStoreCoordinator è sicuro?
- 3. Il thread java.util.Hashtable è sicuro?
- 4. Il thread SecureRandom è sicuro?
- 5. È sicuro il thread SecurityContextHolder?
- 6. Il thread closesocket è sicuro?
- 7. È sicuro il thread unique_ptr?
- 8. Il thread di console.writeline è sicuro?
- 9. Il thread di Windows Win32 è sicuro?
- 10. Il thread QueueSender di JMS è sicuro?
- 11. Delphi - Il thread TClientDataset è sicuro?
- 12. È sicuro il thread Java Regex?
- 13. Il thread Netty Channel.write è sicuro?
- 14. Il thread WCF ClientBase è sicuro?
- 15. È il C# '??' thread operatore sicuro?
- 16. Il thread armadillo solve() è sicuro?
- 17. Il thread java.util.Calendar è sicuro o no?
- 18. In Delphi, il thread OutputDebugString è sicuro?
- 19. è un thread di DatagramSocket.send sicuro?
- 20. Questo thread di codice grafica è sicuro?
- 21. Il thread di utilizzo del blocco è sicuro?
- 22. Il thread PrintWriter di un socket Java è sicuro?
- 23. Il thread della classe DateTimeFormatter di Joda-Time è sicuro?
- 24. Il thread di annullamento della sottoscrizione è sicuro in RxJava?
- 25. Il thread TelemetryClient di Application Insight è sicuro?
- 26. Il thread Java MessageFormat è sicuro? (al contrario di SimpleDateFormat)
- 27. Il thread del metodo onStartCommand (..) di IntentService è sicuro?
- 28. è thread client JAX-RS sicuro
- 29. È sicuro per più thread impostare ServicePointManager.ServerCertificateValidationCallback?
- 30. Questo codice è un thread sicuro?
perché qualcuno dovrebbe votare questa domanda come troppo localizzata? Questa è una domanda buona, ragionevole ed equa. –