github.com/mattermost/mattermost-plugin-api@v0.1.4/cluster/mutex_example_test.go (about) 1 package cluster_test 2 3 import ( 4 "github.com/mattermost/mattermost-plugin-api/cluster" 5 6 "github.com/mattermost/mattermost-server/v6/plugin" 7 ) 8 9 func ExampleMutex() { 10 // Use p.API from your plugin instead. 11 pluginAPI := plugin.API(nil) 12 13 m, err := cluster.NewMutex(pluginAPI, "key") 14 if err != nil { 15 panic(err) 16 } 17 m.Lock() 18 // critical section 19 m.Unlock() 20 }