That should work and probably is working. I expect h.ServeHTTP not
returning as quickly as you expect it to.
What you could try to do to test if there is an issue with decreasing the
atomic value is to split up concur into two counters, one for entry and one
for exit. The difference between the
This is definitely strange. You're using the atomics correctly.
Are you on a 32-bit platform by any chance? If so, try replacing 64-bit
atomics with 32-bit atomics. The 64-bit atomics should work on 32-bit
platforms, but it wouldn't hurt to test that theory.
If you can extract a standalone te
if h.ServeHTTP(w, r) panic and if is panic is not recovered by the handler
you should alwways do:
atomic.AddInt64(&concur, 1)
defer atomic.AddInt64(&concur, -1)
h.ServeHTTP(w, r)
defer functions always run, even in case of panic
--
You received this message because you are subscribed to the Goog
>
> use defer, in case of panic defer will always run , but probably will be
> slower than mutex
>
>
>
atomic.AddInt64(&concur, 1)
defer atomic.AddInt64(&concur, -1)
h.ServeHTTP(w, r)
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To un
you should use uint64.
and to decremente up 1 use atomic.AddUint64(&concur, ^uint64(0))
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@g