Re: [PATCH] Thread-safe xmalloc and xrealloc needs a recursive mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 8, 2010 at 09:15, Johannes Sixt <j.sixt@xxxxxxxxxxxxx> wrote:
> From: Johannes Sixt <j6t@xxxxxxxx>
>
> The mutex used to protect object access (read_mutex) may need to be
> acquired recursively.  Introduce init_recursive_mutex() helper function
> in thread-utils.c that constructs a mutex with the PHREAD_MUTEX_RECURSIVE
> attribute.
>
> pthread_mutex_init() emulation on Win32 is already recursive as it is
> implemented on top of the CRITICAL_SECTION type, which is recursive.
>
>    http://msdn.microsoft.com/en-us/library/ms682530%28VS.85%29.aspx
>
> Add do-nothing compatibility wrappers for pthread_mutexattr* functions.
>
> Initial-version-by: Fredrik Kuivinen <frekui@xxxxxxxxx>
> Signed-off-by: Johannes Sixt <j6t@xxxxxxxx>
> ---
> Am 4/7/2010 16:45, schrieb Fredrik Kuivinen:
>> We only need something like the following (on top of Nico's previous
>> patch). Warning: It hasn't even been compile tested on WIN32.
>
> Unfortunately, it doesn't build. This patch replaces the tip of
> nd/malloc-threading.
>
> BTW, your uses of strerror(errno) in init_recursive_mutex() were wrong
> (pthread functions do not set errno), but it is better in any case to
> avoid die() in this function.

Very true. Thanks.

- Fredrik
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]