mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
Slight refactoring and optimization of some code in WaitOnLock().
This commit is contained in:
parent
a258a1bba8
commit
c129c16492
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.147 2005/03/01 21:14:59 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.148 2005/03/11 03:52:06 neilc Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* Outside modules can create a lock table and acquire/release
|
* Outside modules can create a lock table and acquire/release
|
||||||
@ -1076,6 +1076,7 @@ WaitOnLock(LOCKMETHODID lockmethodid, LOCALLOCK *locallock,
|
|||||||
LockMethod lockMethodTable = LockMethods[lockmethodid];
|
LockMethod lockMethodTable = LockMethods[lockmethodid];
|
||||||
char *new_status,
|
char *new_status,
|
||||||
*old_status;
|
*old_status;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
Assert(lockmethodid < NumLockMethods);
|
Assert(lockmethodid < NumLockMethods);
|
||||||
|
|
||||||
@ -1083,9 +1084,10 @@ WaitOnLock(LOCKMETHODID lockmethodid, LOCALLOCK *locallock,
|
|||||||
locallock->lock, locallock->tag.mode);
|
locallock->lock, locallock->tag.mode);
|
||||||
|
|
||||||
old_status = pstrdup(get_ps_display());
|
old_status = pstrdup(get_ps_display());
|
||||||
new_status = (char *) palloc(strlen(old_status) + 10);
|
len = strlen(old_status);
|
||||||
strcpy(new_status, old_status);
|
new_status = (char *) palloc(len + 8 + 1);
|
||||||
strcat(new_status, " waiting");
|
memcpy(new_status, old_status, len);
|
||||||
|
strcpy(new_status + len, " waiting");
|
||||||
set_ps_display(new_status);
|
set_ps_display(new_status);
|
||||||
|
|
||||||
awaitedLock = locallock;
|
awaitedLock = locallock;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user