This is an archive of the discontinued LLVM Phabricator instance.

[flang] Restore old unit locking behavior
ClosedPublic

Authored by klausler on Dec 6 2022, 3:48 PM.

Details

Summary

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.

Diff Detail

Event Timeline

klausler created this revision.Dec 6 2022, 3:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 3:48 PM
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Dec 6 2022, 3:48 PM
peixin accepted this revision.Dec 6 2022, 5:31 PM

LGTM. Thanks for this support. You may need rebase before landing this. The patch application is not successful now.

This revision is now accepted and ready to land.Dec 6 2022, 5:31 PM
kiranchandramohan accepted this revision.Dec 7 2022, 5:02 AM

LGTM. Also tested with a simple program.

The only question I had is regarding setting pthread_t holder_ to 0, is that a reasonable value and will there be a type mismatch if pthread_t is a struct. I did not face any issues on two compilers I tried.

klausler updated this revision to Diff 481000.Dec 7 2022, 11:50 AM

Avoid assuming that pthread_t can be assigned a zero; rebase.

kiranchandramohan accepted this revision.Dec 8 2022, 8:25 AM

Thanks Peter.

This revision was automatically updated to reflect the committed changes.