[mpich-devel] [mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1.1-8-gbe93cae
Dave Goodell (dgoodell)
dgoodell at cisco.com
Wed Jun 11 14:09:42 CDT 2014
[accidentally responded to moderated commits@, not devel@]
On Jun 11, 2014, at 2:05 PM, Dave Goodell (dgoodell) <dgoodell at cisco.com> wrote:
> On Jun 11, 2014, at 11:01 AM, Service Account <noreply at mpich.org> wrote:
>
>> commit be93caec6c6b9b230fbde9b1b296cde001fde934
>> Author: Antonio J. Pena <apenya at mcs.anl.gov>
>> Date: Mon Jun 9 17:12:17 2014 -0500
>>
>> Added support for thread-safe errno in Solaris
>>
>> The _REENTRANT macro is required to be defined in order to get
>> thread-safe "errno" values. Modern POSIX systems provide this by default
>> when using -lpthreads, but there are still some (Solaris) that require
>> an explicit define. Since we weren't compiling with that macro, we were
>> getting incorrect "errno" values from the threads (mainly 0).
>>
>> More details: since we use nonblocking sockets, our code was checking
>> "errno" to not be EINPROGRESS whenever we got an error code from a
>> connect/accept, in order to determine an actual error (a return value
>> of -1 and errno of EINPROGRESS does not define an actual error but a
>> "not yet" when using nonblocking sockets).
>
> Interesting, I did not know about this Solaris "quirk".
>
>> This patch automatically gets this macro defined by configure whenever
>> we are not building in MPI_THREAD_SINGLE mode only.
>>
>> Fixes #2107
>>
>> Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>
>>
>> diff --git a/configure.ac b/configure.ac
>> index 936f6ce..96545b0 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -1352,6 +1352,13 @@ fi
>> export MPICH_THREAD_LEVEL
>> AC_DEFINE_UNQUOTED(MPICH_THREAD_LEVEL,$MPICH_THREAD_LEVEL,[Level of thread support selected at compile time])
>>
>> +# If not in MPI_THREAD_SINGLE, we need -D_REENTRANT to get thread-safe "errno".
>> +# Most POSIX systems provide this by default when using -lpthread, but we only use it in MPI_THREAD_MULTIPLE.
>> +# Some systems (Solaris) still require an explicit define in any case.
>> +if test "$MPICH_THREAD_LEVEL" != "MPI_THREAD_SINGLE"; then
>> + PAC_APPEND_FLAG([-D_REENTRANT], [CFLAGS])
>
> A largely academic observation, but: should this be CPPFLAGS instead?
>
> -Dave
>
More information about the devel
mailing list