apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harrie Hazewinkel <har...@lisanza.net>
Subject Re: Atomic operations
Date Mon, 11 Feb 2002 19:36:15 GMT

--On Monday, February 11, 2002 8:41 AM -0800 Ian Holsman <ianh@apache.org> 
>> Having done a lot of counting while making SNMP modules, I never needed
>> some king of locking. OK, I admit it is maybe a bit of overhead, but you
>> could create a pipe/channel that logs all required information to some
>> extra thread/process that collects this all for you. Then by having
>> that thread/process doing counting you can do either lock it local
>> (local as in the process/thread) or just serialize all counting messages
>> coming from the pipe.
> The reason I'm doing it is more for reference counting. I need to know
> when a object has no more requests against it, so I can kill it.

I see what you mean. That is indeed better to do with some
overall locking by means of atomic operations. However, a potential
problem of deadlock can arise.

Then a solution could be to create some pipe that logs a claim
and release operations. Although, I admit this could create
some additional load. For each transaction.

Another solution could be to have for each thread/process -
that handles a request - its own registration and the management
module collects all these small pieces of data when needed.

Both solutions create little load per request and more for
the management solution. That is not a real problem, since
management always costs resources while it is not the core
task of the application.

Hope this helps,


mailto: harrie@lisanza.net               http://www.lisanza.net/
Internet Management Consulting

View raw message