Skip to content

Commit f1a01ac

Browse files
committed
40: Mutexes
1 parent 0e1ba6d commit f1a01ac

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ go run . -module closingchannels
5959
* [37 - Waitgroups](waitgroups.go)
6060
* [38 - Rate Limiting](ratelimiting/main.go)
6161
* [39 - Atomic Counters](atomiccounters/main.go)
62+
* [40 - Mutexes](mutexes/main.go)

main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import (
4242
"github.com/symonk/learning-golang/variables"
4343
"github.com/symonk/learning-golang/waitgroups"
4444
"github.com/symonk/learning-golang/workerpools"
45+
"github.com/symonk/learning-golang/mutexes"
4546
)
4647

4748
func main() {
@@ -108,5 +109,6 @@ func buildMap() map[string]func() {
108109
fnMap["waitgroups"] = waitgroups.Run
109110
fnMap["ratelimiting"] = ratelimiting.Run
110111
fnMap["atomiccounters"] = atomiccounters.Run
112+
fnMap["mutexes"] = mutexes.Run
111113
return fnMap
112114
}

mutexes/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
package mutexes
22

3+
// Allows for more complex state synchronisation
4+
// Across multiple goroutines where atomic/counters
5+
// are not enough.
36
func Run() {}

0 commit comments

Comments
 (0)