[Patch, fortran] PR48298 - [F03] User-Defined Derived-Type IO (DTIO)
Paul Richard Thomas
paul.richard.thomas@gmail.com
Mon Aug 22 21:19:00 GMT 2016
I can confirm that all the testcases run correctly with -lpthread.
Good work, Jerry
Paul
On 22 August 2016 at 20:51, Jerry DeLisle <jvdelisle@charter.net> wrote:
> On 08/22/2016 11:20 AM, Jerry DeLisle wrote:
>
>>
>> I am thinking that the parent is holding the mutex lock on the unit. When
>> the
>> child tries to access, it is blocked.
>>
>> I will see if I can reproduce it here and then try to find a solution.
>> Thanks
>> for the report.
>>
>
> The following patchlet steers clear of the locking for child IO since the
> parent is in control.
>
> We are going to have to see if we can test this in some sort of
> multi-threaded situation, but I think it should be OK.
>
> Dominiq, please test on your system.
>
> Regards,
>
> Jerry
>
> diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
> index e0e7b09f..3ab3f81d 100644
> --- a/libgfortran/io/unit.c
> +++ b/libgfortran/io/unit.c
> @@ -348,7 +348,7 @@ retry:
> }
>
> found:
> - if (p != NULL)
> + if (p != NULL && (p->child_dtio == 0))
> {
> /* Fast path. */
> if (! __gthread_mutex_trylock (&p->lock))
> @@ -363,7 +363,7 @@ found:
>
> __gthread_mutex_unlock (&unit_lock);
>
> - if (p != NULL)
> + if (p != NULL && (p->child_dtio == 0))
> {
> __gthread_mutex_lock (&p->lock);
> if (p->closed)
>
> Should we move these discussions to the PR48298?
>
> Jerry
>
>
--
The difference between genius and stupidity is; genius has its limits.
Albert Einstein
More information about the Fortran
mailing list