Share state ( allocated memory ) across two C functions...

Поиск
Список
Период
Сортировка
От Maksim Likharev
Тема Share state ( allocated memory ) across two C functions...
Дата
Msg-id 56510AAEF435D240958D1CE8C6B1770A016D2D7D@mailc03.aurigin.com
обсуждение исходный текст
Ответы Re: [HACKERS] Share state ( allocated memory ) across two C functions...  (Joe Conway <mail@joeconway.com>)
Список pgsql-general
Hi,
I have interesting question that stops me now.
Suppose I have 2 functions

1. preparestate
2. doajob

first allocates some state using
MemoryContextAlloc(TopTransactionContext)
or something, another function using that memory.

question is how I lookup that memory in second function doajob?

Of cause I can return a handle from first function, pointer and accept
that pointer in second function, but in this case I have to check
that pointer on validity and so on...

Is there any good practice ( some way to do so ) for that?

Thank you.


В списке pgsql-general по дате отправления:

Предыдущее
От: "Patrick Hatcher"
Дата:
Сообщение: Pg_Dumpall error?
Следующее
От: Joe Conway
Дата:
Сообщение: Re: [HACKERS] Share state ( allocated memory ) across two C functions...