<?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: atomic operations in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/atomic-operations/m-p/2534841#M890352</link>
    <description>Hi Eyal,&lt;BR /&gt;&lt;BR /&gt;No, the CNX #pragma won't do this for you. It does work for what it intended to do - threads within a single process.&lt;BR /&gt;&lt;BR /&gt;I'll point you to two approaches:&lt;BR /&gt;&lt;BR /&gt;1) If all you are doing is integer flag values,&lt;BR /&gt;   then use semaphores, semop() was made for &lt;BR /&gt;   this and is atomic. Man semop, semget, and semctl for details. Use ftok() to create a mutually agreed upon and reproducible key. Man ftok for those details.&lt;BR /&gt;2) If you are needing to do more complex operations than on operands other than simple integers, then you still use the semaphores as a lock mechanism, do your shared memory stuff, and unlock the semaphore.&lt;BR /&gt;&lt;BR /&gt;This convention will work for threads and processes.&lt;BR /&gt;&lt;BR /&gt;After looking over the man pages, if you are still confused, I can probably give you some simple examples.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;</description>
    <pubDate>Thu, 31 May 2001 14:01:58 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2001-05-31T14:01:58Z</dc:date>
    <item>
      <title>atomic operations</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/atomic-operations/m-p/2534839#M890350</link>
      <description>I need to implement few atomic operation (add, inc, compare and swap, swap)using HPUX 11 (9000). Currently I'm using "#pragme _CNX critical_section". Is there another way? Although is seems to be working between threads in the same process, I'm not sure this way is safe when doing operation on objects in shared memory from several different processes.&lt;BR /&gt;Thanks, Eyal.</description>
      <pubDate>Thu, 31 May 2001 05:59:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/atomic-operations/m-p/2534839#M890350</guid>
      <dc:creator>Eyal Nadler</dc:creator>
      <dc:date>2001-05-31T05:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: atomic operations</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/atomic-operations/m-p/2534840#M890351</link>
      <description>Try:&lt;BR /&gt;&lt;A href="http://devresource.hp.com/CXX/Forums/hpux-devtools/hpux-devtools.html" target="_blank"&gt;http://devresource.hp.com/CXX/Forums/hpux-devtools/hpux-devtools.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 31 May 2001 07:38:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/atomic-operations/m-p/2534840#M890351</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2001-05-31T07:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: atomic operations</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/atomic-operations/m-p/2534841#M890352</link>
      <description>Hi Eyal,&lt;BR /&gt;&lt;BR /&gt;No, the CNX #pragma won't do this for you. It does work for what it intended to do - threads within a single process.&lt;BR /&gt;&lt;BR /&gt;I'll point you to two approaches:&lt;BR /&gt;&lt;BR /&gt;1) If all you are doing is integer flag values,&lt;BR /&gt;   then use semaphores, semop() was made for &lt;BR /&gt;   this and is atomic. Man semop, semget, and semctl for details. Use ftok() to create a mutually agreed upon and reproducible key. Man ftok for those details.&lt;BR /&gt;2) If you are needing to do more complex operations than on operands other than simple integers, then you still use the semaphores as a lock mechanism, do your shared memory stuff, and unlock the semaphore.&lt;BR /&gt;&lt;BR /&gt;This convention will work for threads and processes.&lt;BR /&gt;&lt;BR /&gt;After looking over the man pages, if you are still confused, I can probably give you some simple examples.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;</description>
      <pubDate>Thu, 31 May 2001 14:01:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/atomic-operations/m-p/2534841#M890352</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-05-31T14:01:58Z</dc:date>
    </item>
  </channel>
</rss>

