projects
/
postgresql-pgindent.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4f01103
)
spinlock emulation: Fix bug when more than INT_MAX spinlocks are initialized.
author
Andres Freund
<
[email protected]
>
Mon, 8 Jun 2020 22:25:49 +0000
(15:25 -0700)
committer
Andres Freund
<
[email protected]
>
Wed, 17 Jun 2020 19:51:29 +0000
(12:51 -0700)
Once the counter goes negative we ended up with spinlocks that errored
out on first use (due to check in tas_sema).
Author: Andres Freund
Reviewed-By: Robert Haas
Discussion: https://postgr.es/m/
20200606023103
[email protected]
Backpatch: 9.5-
src/backend/storage/lmgr/spin.c
patch
|
blob
|
blame
|
history
diff --git
a/src/backend/storage/lmgr/spin.c
b/src/backend/storage/lmgr/spin.c
index 1ca718bfd9c957d922d367e146b2cc2ac5b28a4e..dfa47a723fa8e56275052ddc58b81c7c8902d640 100644
(file)
--- a/
src/backend/storage/lmgr/spin.c
+++ b/
src/backend/storage/lmgr/spin.c
@@
-91,7
+91,7
@@
SpinlockSemaInit(PGSemaphore spinsemas)
void
s_init_lock_sema(volatile slock_t *lock, bool nested)
{
- static
int
counter = 0;
+ static
uint32
counter = 0;
*lock = (++counter) % NUM_SPINLOCK_SEMAPHORES;
}