You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Antonio Vieiro <an...@antonioshome.net> on 2011/07/26 13:16:14 UTC

Thread safety of data structures?

Hi all,

I imagine that APR hashtables [1] (and other data structures) are
*not* thread safe; so it's necessary to use mutexes and friends in a
multithreaded environment to work with them, am I right?

Thanks,
Antonio

[1] http://apr.apache.org/docs/apr/1.4/group__apr__hash.html

Re: Thread safety of data structures?

Posted by Antonio Vieiro <an...@antonioshome.net>.
I was wondering if this should be documented somewhere. Shall I file a 
bug report or something?

Even better, shall I write some document about APR?

Cheers,
Antonio

El 26/07/11 18:57, William A. Rowe Jr. escribió:
> On 7/26/2011 4:16 AM, Antonio Vieiro wrote:
>> Hi all,
>>
>> I imagine that APR hashtables [1] (and other data structures) are
>> *not* thread safe; so it's necessary to use mutexes and friends in a
>> multithreaded environment to work with them, am I right?
>>
>> Thanks,
>> Antonio
>>
>> [1] http://apr.apache.org/docs/apr/1.4/group__apr__hash.html
>
> Not for write operations; you are correct.
>
> A read only hash is always threadsafe.


Re: Thread safety of data structures?

Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 7/26/2011 4:16 AM, Antonio Vieiro wrote:
> Hi all,
> 
> I imagine that APR hashtables [1] (and other data structures) are
> *not* thread safe; so it's necessary to use mutexes and friends in a
> multithreaded environment to work with them, am I right?
> 
> Thanks,
> Antonio
> 
> [1] http://apr.apache.org/docs/apr/1.4/group__apr__hash.html

Not for write operations; you are correct.

A read only hash is always threadsafe.