gin-contrib / timeout

Timeout middleware for Gin
MIT License
185 stars 38 forks source link

Doubts about lock/unlock operating range? #6

Open daheige opened 3 years ago

daheige commented 3 years ago

https://github.com/gin-contrib/timeout/blob/e89e167737460b95d6b518d7583d2a321d1fc22b/timeout.go#L98 Which block of logic is the lock/unlock operation here, is it the write to dst, or the entire block from 100 lines to 109 lines? For timeout.go#L114, which is the same for the lock and release locks here? If it is for data writing/reading, see if you use mu sync.Mutex here, can you use rw lock?