package other
import (
"fmt"
"sync"
"testing"
)
type ConcurrentMapShared[V any] struct {
items map[string]V
sync.RWMutex // Read Write mutex, guards access to internal map.
}
func NewCM[V any]() ConcurrentMapShared[V] {
m := &ConcurrentMapShared[V]{items: make(map[string]V)}
return *m
}
func TestName(t *testing.T) {
m := NewCM()
m.items["hah"] = interface{}(1)
fmt.Println(m)
}
//type ConcurrentMapShared struct {
// items map[string]interface{}
// sync.RWMutex // Read Write mutex, guards access to internal map.
//}
//
//func NewCM() ConcurrentMapShared {
// m := &ConcurrentMapShared{items: make(map[string]interface{})}
// return *m
//}
//
//func TestName(t *testing.T) {
//
// m := NewCM()
// m.items["hah"] = interface{}(1)
//
// fmt.Println(m)
//}
//
Post Views: 1,152