# Basic OpenMP Test Program Not Exiting

**URL:** <https://fortran-lang.discourse.group/t/basic-openmp-test-program-not-exiting/9413>\
**Category:** Uncategorized\
**Created:** [March 19, 2025, 8:43pm UTC](https://fortran-lang.discourse.group/t/basic-openmp-test-program-not-exiting/9413 "2025-03-19T20:43:28Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [March 20, 2025, 8:58pm UTC](https://fortran-lang.discourse.group/t/basic-openmp-test-program-not-exiting/9413/8 "2025-03-20T20:58:47Z")

</div>

Maybe it is this issue

> [@OpenMP and thread-safety of I/Os (write, read...)](https://fortran-lang.discourse.group/t/openmp-and-thread-safety-of-i-os-write-read/4567/13):
>
> Actually I am OK with my current practice of putting all I/Os in critical sections. I was just wondering of the thread-safety of I/Os was covered by the standards (Fortran and/or OpenMP) or not. It seems that the answer is “no” (in which case one should always use critical sections if one wants the code to be portable and not depend on a specific compiler). Do you have a link?

Can you try to use the modified program:

```fortran
  !$OMP PARALLEL
    !$OMP CRITICAL
    PRINT *, "Hello from process: ", OMP_GET_THREAD_NUM()
    !$OMP END CRITICAL
  !$OMP END PARALLEL

```

Or maybe this other modification:

```fortran
!$OMP PARALLEL
   id = omp_get_thread_num()
   print *, "Hello from process: ", id
!$OMP END PARALLEL

```

Just curious if it changes anything.

---

_[View the full topic](https://fortran-lang.discourse.group/t/basic-openmp-test-program-not-exiting/9413)._
