Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit92edd42

Browse files
committed
Make HP-PA S_UNLOCK a little faster and less dependent on unspecified compiler codegen details.
Make default S_LOCK macro more robust against syntax mistakes.(I cleared these changes with David Gould a few days ago.)
1 parent0d1aa5a commit92edd42

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

‎src/include/port/hpux.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#defineHAS_TEST_AND_SET
1010
typedefstruct
1111
{
12-
intsem[4];
12+
intsema[4];
1313
}slock_t;
1414

1515
#ifndefBIG_ENDIAN

‎src/include/storage/s_lock.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.50 1998/09/21 02:25:27 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.51 1998/10/01 01:53:50 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -243,16 +243,20 @@ tas(slock_t *s_lock)
243243
* HP-UX (PA-RISC)
244244
*
245245
* Note that slock_t on PA-RISC is a structure instead of char
246-
* (seestorage/ipc.h).
246+
* (seeinclude/port/hpux.h).
247247
*
248248
* a "set" slock_t has a single word cleared. a "clear" slock_t has
249249
* all words set to non-zero. tas() in tas.s
250250
*/
251-
staticconstslock_tclear_lock=
252-
{{-1,-1,-1,-1}};
253251

254-
#defineS_UNLOCK(lock)(*(lock) = clear_lock)/* struct assignment */
252+
#defineS_UNLOCK(lock) \
253+
{ \
254+
volatile slock_t *lock_ = (volatile slock_t *) (lock); \
255+
lock_->sema[0] = lock_->sema[1] = lock_->sema[2] = lock_->sema[3] = -1; \
256+
}
257+
255258
#defineS_LOCK_FREE(lock)( *(int *) (((long) (lock) + 15) & ~15) != 0)
259+
256260
#endif/* __hpux */
257261

258262

@@ -322,9 +326,10 @@ static const slock_t clear_lock =
322326
externvoids_lock(volatileslock_t*lock,constchar*file,constintline);
323327

324328
#defineS_LOCK(lock) \
325-
if (TAS((volatile slock_t *) lock)) {\
326-
s_lock((volatile slock_t *) lock, __FILE__, __LINE__); \
327-
} else
329+
do { \
330+
if (TAS((volatile slock_t *) lock)) \
331+
s_lock((volatile slock_t *) lock, __FILE__, __LINE__); \
332+
} while (0)
328333
#endif/* S_LOCK */
329334

330335
#if !defined(S_LOCK_FREE)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp