apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51392] New: apr_pool_t thread-safe pool creation
Date Fri, 17 Jun 2011 11:02:35 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51392

             Bug #: 51392
           Summary: apr_pool_t thread-safe pool creation
           Product: APR
           Version: 1.4.5
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: PatchAvailable
          Severity: enhancement
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: bugzilla@pirosa.co.uk
    Classification: Unclassified


Created attachment 27169
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27169
Patches apr_pools.c and apr_pools.h to add thread-safe pools

There are times that I want to use a data structure across multiple threads,
adding to it if necessary. Not in Apache Web Server, but in dedicated projects
that use the APR library.

I have proposed to add the apr_pool_create_threadsafe and (_ex and _ex_debug
functions) which set a boolean flag in apr_pool_t to indicate that allocations
should be protected by the pool's mutex.

Consider the situation where you create two apr_hash_t variables, and then
spawn off n threads to process a CPU intensive operation, each thread updating
the two variables as they see fit (appropriately locking each one as it is
accessed). If the two hashes are from the same pool it is possible they could
corrupt the pool if grown at the same time.

Also stopped apr_pool_check_integrity() from complaining if a thread-safe pool
is not owned by current thread (in fact, it shouldn't complain at all when
creating pools because pool creation is thread-safe anyway).

Untested - but should give a taste for others should they wish to have such
functionality.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message