You will need to use CGo. See Chaney “id” project for ideas. Since the underlying OS threads are shared and will not be switched while in the C code it is fairly straightforward but having a robust typed cache will be problematic.
There are discussions on golang-dev about named Go routines which might be a workaround, but so far the TLS (or PLS) discussion has been a non starter. > On Jul 23, 2019, at 12:10 PM, Zihan Yang <whois.zihan.y...@gmail.com> wrote: > > I am trying to implement an LRU cache. Several global lru lists could be > accessed concurrently by multiple goroutines, which could be a disaster in a > machine with 24 or more cores. > > > > Therefore, it would be great if I can add the item to P-local storage and > flush the batched item into the lru list as a whole. This should greatly > reduce the contention for the global lru list. > > > > How can I do it? I saw some related github issues, #8281 and #21355, which > leads me to a project called gls, but the code seems too much to integrate > into my project (actually I'd better not include any third-party package to > avoid potential law issues). Is there any built-in way to achieve this? > > > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/c79d3801-2f03-43fd-8dd8-35904b481341%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/A3408951-C5C8-4699-96E3-DFED6FB8B4C6%40ix.netcom.com.