You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Stephen Ince <si...@opendemand.com> on 2004/01/16 07:37:14 UTC

apr threads priority and default memory pool allocation

Hi,
    I am relatively new to the apr. I would like to the know the following.

1) Is it possible to set the default memory allocation for a sub pool or a pool? I looked at the code and I noticed that the minimum size is 8k. This seems quite large.

psuedo code:
   apr_pool_create(&sub_pool, pool);
    // Is the real memory for the sub_pool initialially being allocated 8k, or does it use the
    // real memory that is allocated in the parent 'pool'? Does it only request memory from
    // the system if the parent pool requires it.


2) Is it possible to set the thread priority for apr threads in Windows and Unix.

psuedo code:
               if ((stat = apr_thread_create(&new_thead, NULL, start_function, dummy, pool)) != APR_SUCCESS)
              {
                  return stat;
              }
              // set the thread priority for new_thead

Steve

Re: apr threads priority and default memory pool allocation

Posted by Stephen Ince <si...@opendemand.com>.
I will answer my own question on 'setting thread priority' . It seems that
the apr  doesn't have a platform independent way to set the thread priority.
You have to get a handle to the implementation and set it accordingly.

Example.
#ifdef WIN32
#include <arch/win32/apr_arch_threadproc.h>
#endif
:
:
#ifdef WIN32
            SetThreadPriority( OpenloadPrintingThread->td,
THREAD_PRIORITY_ABOVE_NORMAL );
#elif APR_HAVE_PTHREAD_H
/* do the pthread version */
#endif

Steve
----- Original Message ----- 
From: "Sander Striker" <st...@apache.org>
To: "Stephen Ince" <si...@opendemand.com>
Cc: <de...@apr.apache.org>; <dd...@opendemand.com>
Sent: Friday, January 16, 2004 3:16 AM
Subject: Re: apr threads priority and default memory pool allocation


> On Fri, 2004-01-16 at 07:37, Stephen Ince wrote:
> > Hi,
> >     I am relatively new to the apr. I would like to the know
> > the following.
> >
> > 1) Is it possible to set the default memory allocation for a sub pool
> > or a pool? I looked at the code and I noticed that the minimum size is
> > 8k. This seems quite large.
> >
> > psuedo code:
> >    apr_pool_create(&sub_pool, pool);
> >     // Is the real memory for the sub_pool initialially being
> > allocated 8k,
>
> Yes.
>
> >  or does it use the
> >     // real memory that is allocated in the parent 'pool'?
>
> No, although we could probably code that up, with the sidenote
> that moving a child pool to a different parent is impossible
> to implement thereafter.
>
> >  Does it only request memory from
> >     // the system if the parent pool requires it.
>
> It only requests memory when the allocator associated with the
> pool requires it.  Parent and child pools don't neccessarily share
> the same allocator.
>
>
> Sander
>


Re: apr threads priority and default memory pool allocation

Posted by Stephen Ince <si...@opendemand.com>.
Sander,
    Thx for your prompt reply. I looked at the pool and it isn't really
obvious how to set the default memory size. I assume you get the allocator
and set the size but how?

Steve

----- Original Message ----- 
From: "Sander Striker" <st...@apache.org>
To: "Stephen Ince" <si...@opendemand.com>
Cc: <de...@apr.apache.org>; <dd...@opendemand.com>
Sent: Friday, January 16, 2004 3:16 AM
Subject: Re: apr threads priority and default memory pool allocation


> On Fri, 2004-01-16 at 07:37, Stephen Ince wrote:
> > Hi,
> >     I am relatively new to the apr. I would like to the know
> > the following.
> >
> > 1) Is it possible to set the default memory allocation for a sub pool
> > or a pool? I looked at the code and I noticed that the minimum size is
> > 8k. This seems quite large.
> >
> > psuedo code:
> >    apr_pool_create(&sub_pool, pool);
> >     // Is the real memory for the sub_pool initialially being
> > allocated 8k,
>
> Yes.
>
> >  or does it use the
> >     // real memory that is allocated in the parent 'pool'?
>
> No, although we could probably code that up, with the sidenote
> that moving a child pool to a different parent is impossible
> to implement thereafter.
>
> >  Does it only request memory from
> >     // the system if the parent pool requires it.
>
> It only requests memory when the allocator associated with the
> pool requires it.  Parent and child pools don't neccessarily share
> the same allocator.
>
>
> Sander
>


Re: apr threads priority and default memory pool allocation

Posted by Sander Striker <st...@apache.org>.
On Fri, 2004-01-16 at 07:37, Stephen Ince wrote:
> Hi,
>     I am relatively new to the apr. I would like to the know
> the following.
>  
> 1) Is it possible to set the default memory allocation for a sub pool
> or a pool? I looked at the code and I noticed that the minimum size is
> 8k. This seems quite large.
>  
> psuedo code:
>    apr_pool_create(&sub_pool, pool); 
>     // Is the real memory for the sub_pool initialially being
> allocated 8k,

Yes.

>  or does it use the
>     // real memory that is allocated in the parent 'pool'?

No, although we could probably code that up, with the sidenote
that moving a child pool to a different parent is impossible
to implement thereafter.

>  Does it only request memory from
>     // the system if the parent pool requires it.

It only requests memory when the allocator associated with the
pool requires it.  Parent and child pools don't neccessarily share
the same allocator.


Sander