go-radix icon indicating copy to clipboard operation
go-radix copied to clipboard

concurrency

Open pjebs opened this issue 3 years ago • 1 comments

Can this be used from multiple concurrent goroutines?

pjebs avatar Nov 06 '20 10:11 pjebs

I think you can think of this like a Go map. If you create the trie first in one goroutine, then you can use any number of goroutines for reading the trie later on. But if you want to keep modifying the trie, you need to add your own mutex wrappers around the accesses.

FrankReh avatar Nov 06 '20 15:11 FrankReh

Thanks @FrankReh that is correct. The data structure does no internally locking, so you would need to wrap it if you needed thread safety.

armon avatar Nov 18 '22 15:11 armon