kamilsk / semaphore

🚦 Semaphore pattern implementation with timeout of lock/unlock operations.
MIT License
103 stars 12 forks source link

performance review #130

Closed kamilsk closed 5 years ago

kamilsk commented 6 years ago

need to define overhead of the package

kamilsk commented 6 years ago

time.NewTimer instead of time.After: investigate "under the hood" benefits (related to GC)

kamilsk commented 6 years ago

time.After do not release app resource, but timer can do it

kamilsk commented 6 years ago
timer := time.NewTimer(deadline)
semaphore.Acquire(timer.C)
if ok -> timer.Stop() and continue
kamilsk commented 5 years ago

won't do