<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: pthread_cleanup_push in FORTRAN in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/pthread-cleanup-push-in-fortran/m-p/4061609#M38374</link>
    <description>Michael,&lt;BR /&gt;&lt;BR /&gt;  FORTRAN isn't really the best choice of language for playing with threads. Although FORTRAN90 has come a long way, (some would say to turning FORTRAN into PASCAL ;-) there are still quite a few FORTRANish things like static variables and, in some case, argument lists which can make threading very difficult to use reliably. You need to be aware of any reentrancy and sharing of storage. Stack based languages make it all much simpler.&lt;BR /&gt;&lt;BR /&gt;  If you can't implement your threading stuff in C, you will need to reimplement the macro in FORTRAN. First locate where the definition comes from (if you have a C compiler, generate a listing with expanded includes and macros), now all you have to do is work out what the macro does! Of course we all know that C code is always readable :-)</description>
    <pubDate>Tue, 28 Aug 2007 18:23:19 GMT</pubDate>
    <dc:creator>John Gillings</dc:creator>
    <dc:date>2007-08-28T18:23:19Z</dc:date>
    <item>
      <title>pthread_cleanup_push in FORTRAN</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/pthread-cleanup-push-in-fortran/m-p/4061607#M38372</link>
      <description>Working on Alpha/IA64 V8.3 I have a FORTRAN V8.0 program which creates a thread (to assign some computations to a second cpu) using the pthread library (pthread_create).&lt;BR /&gt;Thread creator and thread are both FORTRAN90 subroutines. When the thread is no longer required, the creator calls pthread_cancel.&lt;BR /&gt;Before the thread exits it has to release some resources like locked mutexes. For this purpose there is a pthread_cleanup_push function in the pthread interface, but it is implemented as a C macro so cannot be called from a FORTRAN subroutine (guide to POSIX Thread Library, pthread-54).&lt;BR /&gt;How can I implement this macro in FORTRAN? Both examples in the documentation are writen in C.</description>
      <pubDate>Tue, 28 Aug 2007 08:31:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/pthread-cleanup-push-in-fortran/m-p/4061607#M38372</guid>
      <dc:creator>Michael Menge</dc:creator>
      <dc:date>2007-08-28T08:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: pthread_cleanup_push in FORTRAN</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/pthread-cleanup-push-in-fortran/m-p/4061608#M38373</link>
      <description>I know nothing, but I'd guess that the easy&lt;BR /&gt;way would be to write C wrapper functions&lt;BR /&gt;which _could_ use the C macros (in pthread.h&lt;BR /&gt;and/or pthread_exception.h).  Otherwise, I'd&lt;BR /&gt;probably try to draw out what these macros&lt;BR /&gt;would get expanded into, and see if it's&lt;BR /&gt;practical to re-code the resulting mess in&lt;BR /&gt;Fortran.  (Looks nasty to me, but I'd assume&lt;BR /&gt;that it's possible, at least until I actually&lt;BR /&gt;sat down and tried to do it.)</description>
      <pubDate>Tue, 28 Aug 2007 14:37:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/pthread-cleanup-push-in-fortran/m-p/4061608#M38373</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2007-08-28T14:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: pthread_cleanup_push in FORTRAN</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/pthread-cleanup-push-in-fortran/m-p/4061609#M38374</link>
      <description>Michael,&lt;BR /&gt;&lt;BR /&gt;  FORTRAN isn't really the best choice of language for playing with threads. Although FORTRAN90 has come a long way, (some would say to turning FORTRAN into PASCAL ;-) there are still quite a few FORTRANish things like static variables and, in some case, argument lists which can make threading very difficult to use reliably. You need to be aware of any reentrancy and sharing of storage. Stack based languages make it all much simpler.&lt;BR /&gt;&lt;BR /&gt;  If you can't implement your threading stuff in C, you will need to reimplement the macro in FORTRAN. First locate where the definition comes from (if you have a C compiler, generate a listing with expanded includes and macros), now all you have to do is work out what the macro does! Of course we all know that C code is always readable :-)</description>
      <pubDate>Tue, 28 Aug 2007 18:23:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/pthread-cleanup-push-in-fortran/m-p/4061609#M38374</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2007-08-28T18:23:19Z</dc:date>
    </item>
  </channel>
</rss>

