! This function is not thread-safe, because it writes to global variables. Real Function f(x,y) Real,Intent(In) :: x,y Real :: z Common/c/z(2) Real,External :: sum_of_z z(1) = x z(2) = y f = sum_of_z() End Function ! This function is thread-safe, as although it reads from global variables, ! it does not change any. Real Function sum_of_z() Real z Common/c/z(2) sum_of_z = Sum(z) End Function ! This function is thread-safe, as it has no side-effects. Real Function g(x,y) Real x,y g = x + y**2 End Function