Globals Storage and Thread-safety

From: <mkscott(at)sacadia(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Globals Storage and Thread-safety
Date: 2002-02-19 19:57:19
Message-ID: Pine.GSO.4.10.10202191135120.12782-200000@goldengate.kojoworldwide.com.
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Hi All,

This patch is to start up a globals storage environment
and, in the future, thread-safety. It includes three new files:

env/env.h -- Header for globals storage
env/env.c -- Source for globals storage and creation
env/thread.h -- Header for possible future thread implementation

I created a new subsystem directory but they can go where appropriate.

Implementation is very much like shared memory storage. The globals
environment is a hashtable that stores stuctures for the various
subsystems. Developers would be able to create structures to store
and retrieve items
that would normally be held in global variables. The hashtable is keyed
by an int that identifies the specific global.

I had to change dynahash.c to use MemoryContexts only if HASH_ALLOC and
HASH_CONTEXT are not set in the control flags.

I have included an example implementation for the MemoryContext globals.
It uses #defines to redefine the globals to the stored
structure if compiled with USE_GLOBAL_ENVIRONMENT. This is probably
should be optimized to reduce the number of calls to retrieve storage but
I will worry about that when and if the patch is accepted.

Thanks,

Myron Scott
mkscott(at)sacadia(dot)com

Attachment Content-Type Size
globals_patch.diff text/plain 19.3 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tatsuo Ishii 2002-02-20 00:50:59 Re: Bug-report about pgaccess for kanji-use
Previous Message Bruce Momjian 2002-02-19 15:50:35 Re: elog cleanup