help in allocating shared module within a module - Mailing list pgsql-hackers

From Luca Ferrari
Subject help in allocating shared module within a module
Date
Msg-id CAKoxK+7f2m1ruBMoY8C=sucR2W2t8jDg-BXHzhfcc6EcO6BtWg@mail.gmail.com
Whole thread Raw
Responses Re: help in allocating shared module within a module
List pgsql-hackers
Hi all,
hope this is the right place to ask for, otherwise please point me in
the right resource.
I'm trying to develop a module that needs shared memory between
background workers.

The _PG_init calls a function to reserve the shared memory, which in
turn calls RequestAddinShmemSpace, which seems to fail. In fact, I
never got the debug line after the call to RequestAddinShmemSpaec and
_PG_init does not conitnue.

Here is my code skeleton:

void
_PG_init(void)
{

    if ( ! process_shared_preload_libraries_in_progress )
        return;



    // set up the GUCs
    _define_gucs();


    // set up the shared memory
    _create_shared_memory();

...
}


void
_create_shared_memory()
{
  Size estimated_size = 10136:

  elog( DEBUG2, "shared allocation %lu", estimated_size );

  RequestAddinShmemSpace( estimated_size );

  elog(DEBUG2, "never reached!" );
...
}

What am I missing here?

Thanks,
Luca



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Using Expanded Objects other than Arrays from plpgsql
Next
From: Melanie Plageman
Date:
Subject: Re: Eagerly scan all-visible pages to amortize aggressive vacuum