apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <...@apache.org>
Subject Re: Usage of Apache Portable Runtime in Celix
Date Tue, 26 Apr 2011 16:07:51 GMT
On Tue, 26 Apr 2011 16:34:55 +0200
Alexander Broekhuis <a.broekhuis@gmail.com> wrote:

> Some questions I have:
> One of the possible targets of Celix is the embeded world. Is there
> some work and/or knowledge regarding the usage of APR with for example
> TI SYS/BIOS? If not, it is possible/difficult to implement (a subset
> of) the APR headers for other platform?

I don't think APR cares much.  You would have to instantiate
those APR APIs that aren't currently available for the platform.

I wouldn't go down the road of a subset of the APR headers.  I once
did that, and it was a mistake.  However, you can achieve the same
result by returning APR_ENOTIMPL error for functions you have yet
to support.  That is common practice, and APR applications should
expect to handle the error.

> What is a good way to look at the usage of memory pools? Celix

Pools aren't just about memory.  You can allocate any kind of
resource and tie it to a pool to ensure timely cleanup.

The crucial question is how you define timely cleanup.  If you
have objects with well-defined lifetimes that can be cleaned up
without undue complexity, then pools are a good match.  If not
then pools may create more problems than they solve.  Pools are
central to APR, so the question of whether pools work well for
you is likely to determine whether APR itself is worth your while.

> provides a middleware layer on top of which functionality must be
> deployed. Should the use of APR be something we enforce to the users?
> Or can we keep the APR usage internal, so the user can still decide
> what to do.

If you use APR internally then you should encourage your applications
to do likewise.

> So now I'm struggling with when to use a new pool, when to clean the
> pools etc. Is there some general advice for this, or does it depend to
> much on the design of Celix?

If those questions cause you problems, it could be an indication
that pools are not a good match for your proposed usage.

Take a look at httpd usage, where pools are a great match for objects
like a TCP connection or HTTP request having a well-defined lifetime,
and work nicely to manage everything you allocate in processing a request.
And read my ancient piece at http://www.apachetutor.org/dev/pools


-- 
Nick Kew

Available for work, contract or permanent.
http://www.webthing.com/~nick/cv.html

Mime
View raw message