diff options
Diffstat (limited to 'doc/src/sgml/xfunc.sgml')
-rw-r--r-- | doc/src/sgml/xfunc.sgml | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 93bdf572f37..dff7964925b 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.151 2010/07/26 20:14:05 petere Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.152 2010/07/29 19:34:40 petere Exp $ --> <sect1 id="xfunc"> <title>User-Defined Functions</title> @@ -3359,22 +3359,22 @@ void RequestAddinLWLocks(int n) <function>AddinShmemInitLock</> when connecting to and initializing its allocation of shared memory, as shown here: <programlisting> - static mystruct *ptr = NULL; +static mystruct *ptr = NULL; - if (!ptr) +if (!ptr) +{ + bool found; + + LWLockAcquire(AddinShmemInitLock, LW_EXCLUSIVE); + ptr = ShmemInitStruct("my struct name", size, &found); + if (!found) { - bool found; - - LWLockAcquire(AddinShmemInitLock, LW_EXCLUSIVE); - ptr = ShmemInitStruct("my struct name", size, &found); - if (!found) - { - initialize contents of shmem area; - acquire any requested LWLocks using: - ptr->mylockid = LWLockAssign(); - } - LWLockRelease(AddinShmemInitLock); + initialize contents of shmem area; + acquire any requested LWLocks using: + ptr->mylockid = LWLockAssign(); } + LWLockRelease(AddinShmemInitLock); +} </programlisting> </para> </sect2> |