[flang] Restore old unit locking behavior
authorPeter Klausler <pklausler@nvidia.com>
Tue, 6 Dec 2022 22:00:21 +0000 (14:00 -0800)
committerPeter Klausler <pklausler@nvidia.com>
Thu, 8 Dec 2022 16:34:46 +0000 (08:34 -0800)
commit00a1c6d036328db46c20cda88edb020ddbda05b4
tree09e0e7a024921d65b43c28852f4cab58ddbf898a
parent690bed8c62c77e85381953650f0457b7095692df
[flang] Restore old unit locking behavior

Rework  the recursive I/O error check on I/O units so that
threads again hold a lock on a unit throughout an I/O statement.
Add an API to the runtime's Lock class implementation for pthreads
to allow detection of solf-deadlock without depending on EDEADLK
or recursive mutexes.

This should fix I/O from OpenMP threads.

Differential Revision: https://reviews.llvm.org/D139477
flang/runtime/lock.h
flang/runtime/unit.cpp
flang/runtime/unit.h