[flang-commits] [flang] Move deallocation of I/O resources under STOP to a critical section (PR #74181)
via flang-commits
flang-commits at lists.llvm.org
Tue Dec 5 19:39:45 PST 2023
NimishMishra wrote:
> I don't understand why this lock is needed here. CloseAllExternalUnits ends up calling ExternalFileUnit::CloseAll, which already has a critical section in it.
It seems like `ExternalFileUnit::CloseAll` is closing up the I/O buffers while other threads in the parallel region are still operating upon them. The `ExternalFileUnit::CloseAll` critical section is for the collection of buckets to be freed. I was wondering if increasing the scope of the critical section could help, and hence went this way in this patch.
Could I do this better? Ideally, we would want all threads to flush their contents before closing the I/O buffers.
https://github.com/llvm/llvm-project/pull/74181
More information about the flang-commits
mailing list