[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    [GENERAL] Share state ( allocated memory ) across two C functions...
From:       "Maksim Likharev" <mlikharev () aurigin ! com>
Date:       2003-06-30 22:57:26
[Download RAW message or body]

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.


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic