Re: [PATCH] Fix PR119136 Printing result of function that prints itself hangs

Jakub Jelinek <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <aVh3LRWcfNgvR5P1@tucnak>
On Fri, Jan 02, 2026 at 05:35:01PM -0800, Jerry D wrote:
> > Recursive I/O shouldn't indeed be allowed, but multiple threads
> > trying to transfer concurrently should be fine (of course, locking
> > should be used for that).
> 
> I am looking for a way to check if libgomp is active and if so skip the
> check. If there is no such mechanism than I will revert the patch and we
> will need to find some other way to detect the recursive I/O.

IMHO it shouldn't depend on whether libgomp is linked or not, it can be also
dlopened later, or one could link against libpthread (which e.g. in newer
glibc is just in libc) and build threads manually etc.

When using pthread_mutex_*, if it was PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
rather than the normal mutex kind, you'd get EDEADLK from pthread_mutex_lock
if already locked by the current thread.  But guess it would need some extra
tweaks in gthr*.h.

	Jakub
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.