<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Wanted: a portable mutex and atomic refcount</title>
	<atom:link href="http://blog.reverberate.org/2009/08/14/wanted-a-portable-mutex-and-atomic-refcount/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.reverberate.org/2009/08/14/wanted-a-portable-mutex-and-atomic-refcount/</link>
	<description>parsing, performance, minimalism with C99</description>
	<lastBuildDate>Mon, 06 Feb 2012 23:44:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dave</title>
		<link>http://blog.reverberate.org/2009/08/14/wanted-a-portable-mutex-and-atomic-refcount/comment-page-1/#comment-1436</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Mon, 17 Aug 2009 22:28:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.reverberate.org/?p=275#comment-1436</guid>
		<description>One of my projects, the Open Portable Atomics (or sometimes OpenPA or OPA) would probably fulfill at least half of your requirements.  We support a half-dozen or so (depending on how you count it) architectures right now with plans to add more incrementally.  We would also welcome contributions if you have a platform that you need it to work on.  The license is very permissive, basically MIT-style, do whatever you want with it.

https://trac.mcs.anl.gov/projects/openpa/

It of course provides _more_ functionality than you need, but not excessively so.  So you might count it out on the basis of &quot;not tiny enough for Josh&#039;s taste&quot; ;)  It definitely doesn&#039;t live in one header file, we typically use one header for each platform.  At the very least you could use it as the starting point for your crazy minimalist implementation, since writing this sort of thing is *very* error prone.

One of the goals for the library is simplicity of use, which means that we made design decisions to minimize the amount of feature testing that you need to do as the consumer of the API.  This is in stark contrast to the libatomic_ops project which attempts to provide atomics for most/all fixed width types on the platform in full combination with the various memory barrier types (last time I looked at it, anyway).

Do you really want it to compile to nothing if you specify NO_THREAD_SAFETY or do you want thread-unsafe operations to occur instead?  I can see use cases for both, although probably the thread-unsafe version is what you want in most cases.

We have a layer in MPICH2 that wraps pthreads, windows, and solaris mutex APIs, although it is extremely ugly and there&#039;s no way that you would be able to sensibly disentangle it from the library (that&#039;s all legacy code that I didn&#039;t write).  That&#039;s something that would probably be worth implementing in OPA some day, although I doubt I&#039;ll get around to it any time soon.  Getting into the business of wrapping the threading library is a whole separate can of portability worms than writing atomic assembly inlines.

Mail me if you want more detailed info about OPA.</description>
		<content:encoded><![CDATA[<p>One of my projects, the Open Portable Atomics (or sometimes OpenPA or OPA) would probably fulfill at least half of your requirements.  We support a half-dozen or so (depending on how you count it) architectures right now with plans to add more incrementally.  We would also welcome contributions if you have a platform that you need it to work on.  The license is very permissive, basically MIT-style, do whatever you want with it.</p>
<p><a href="https://trac.mcs.anl.gov/projects/openpa/" rel="nofollow">https://trac.mcs.anl.gov/projects/openpa/</a></p>
<p>It of course provides _more_ functionality than you need, but not excessively so.  So you might count it out on the basis of &#8220;not tiny enough for Josh&#8217;s taste&#8221; <img src='http://blog.reverberate.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   It definitely doesn&#8217;t live in one header file, we typically use one header for each platform.  At the very least you could use it as the starting point for your crazy minimalist implementation, since writing this sort of thing is *very* error prone.</p>
<p>One of the goals for the library is simplicity of use, which means that we made design decisions to minimize the amount of feature testing that you need to do as the consumer of the API.  This is in stark contrast to the libatomic_ops project which attempts to provide atomics for most/all fixed width types on the platform in full combination with the various memory barrier types (last time I looked at it, anyway).</p>
<p>Do you really want it to compile to nothing if you specify NO_THREAD_SAFETY or do you want thread-unsafe operations to occur instead?  I can see use cases for both, although probably the thread-unsafe version is what you want in most cases.</p>
<p>We have a layer in MPICH2 that wraps pthreads, windows, and solaris mutex APIs, although it is extremely ugly and there&#8217;s no way that you would be able to sensibly disentangle it from the library (that&#8217;s all legacy code that I didn&#8217;t write).  That&#8217;s something that would probably be worth implementing in OPA some day, although I doubt I&#8217;ll get around to it any time soon.  Getting into the business of wrapping the threading library is a whole separate can of portability worms than writing atomic assembly inlines.</p>
<p>Mail me if you want more detailed info about OPA.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

