<?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: 一看就知道 &#8211; 不 Thread-Safe 的 API</title>
	<atom:link href="http://fsfoundry.org/codefreak/2009/12/01/identifying-api-without-thread-safety/feed/" rel="self" type="application/rss+xml" />
	<link>http://fsfoundry.org/codefreak/2009/12/01/identifying-api-without-thread-safety/</link>
	<description>Weblog of a lively geek.</description>
	<lastBuildDate>Tue, 27 Jul 2010 06:54:46 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: fr3@K</title>
		<link>http://fsfoundry.org/codefreak/2009/12/01/identifying-api-without-thread-safety/comment-page-1/#comment-10353</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Fri, 04 Dec 2009 02:06:15 +0000</pubDate>
		<guid isPermaLink="false">http://fsfoundry.org/codefreak/?p=700#comment-10353</guid>
		<description>@av,

jeff 的意思是說 MS 提供的 runtime library 常會做非標準的事情. 例如 inet_ntoa 的回傳字串的實作.
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://linux.die.net/man/3/inet_ntoa&quot; rel=&quot;nofollow&quot;&gt;POSIX&lt;/a&gt; (BSD)&lt;/li&gt;
&lt;blockquote&gt;... The string is returned in a statically allocated buffer, which subsequent calls will overwrite.&lt;/blockquote&gt;
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms738564(VS.85).aspx&quot; rel=&quot;nofollow&quot;&gt;WIN32&lt;/a&gt;&lt;/li&gt;
&lt;blockquote&gt;... The string returned is guaranteed to be valid only until the next Windows Sockets function call is made within the same thread.&lt;/blockquote&gt;
&lt;/ul&gt;

於是, 在 windows 上的 programmer 並不會知道程式寫錯了, 那些問題也只會在程式要從 windows 跨到其他 platform 時爆炸.</description>
		<content:encoded><![CDATA[<p>@av,</p>
<p>jeff 的意思是說 MS 提供的 runtime library 常會做非標準的事情. 例如 inet_ntoa 的回傳字串的實作.</p>
<ul>
<li><a href="http://linux.die.net/man/3/inet_ntoa" rel="nofollow">POSIX</a> (BSD)</li>
<blockquote><p>&#8230; The string is returned in a statically allocated buffer, which subsequent calls will overwrite.</p></blockquote>
<li><a href="http://msdn.microsoft.com/en-us/library/ms738564(VS.85).aspx" rel="nofollow">WIN32</a></li>
<blockquote><p>&#8230; The string returned is guaranteed to be valid only until the next Windows Sockets function call is made within the same thread.</p></blockquote>
</ul>
<p>於是, 在 windows 上的 programmer 並不會知道程式寫錯了, 那些問題也只會在程式要從 windows 跨到其他 platform 時爆炸.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: av</title>
		<link>http://fsfoundry.org/codefreak/2009/12/01/identifying-api-without-thread-safety/comment-page-1/#comment-10351</link>
		<dc:creator>av</dc:creator>
		<pubDate>Thu, 03 Dec 2009 17:46:55 +0000</pubDate>
		<guid isPermaLink="false">http://fsfoundry.org/codefreak/?p=700#comment-10351</guid>
		<description>boost 的 thread_specific_ptr 應該就派的上用場了，不過我沒用過，不敢肯定。</description>
		<content:encoded><![CDATA[<p>boost 的 thread_specific_ptr 應該就派的上用場了，不過我沒用過，不敢肯定。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://fsfoundry.org/codefreak/2009/12/01/identifying-api-without-thread-safety/comment-page-1/#comment-10342</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Tue, 01 Dec 2009 06:41:16 +0000</pubDate>
		<guid isPermaLink="false">http://fsfoundry.org/codefreak/?p=700#comment-10342</guid>
		<description>Visual Studio 的骯髒解法是，針對這種 API，就 per thread 建立一個 buffer，指標存在 TLS (thread local storage) 裡，然後回傳之。

於是 upgrade visual studio 版本後，或是一開始就發現，程式很神奇的不會爛掉，但是當 porting 到其它「正常」的平台後，就爛掉了。</description>
		<content:encoded><![CDATA[<p>Visual Studio 的骯髒解法是，針對這種 API，就 per thread 建立一個 buffer，指標存在 TLS (thread local storage) 裡，然後回傳之。</p>
<p>於是 upgrade visual studio 版本後，或是一開始就發現，程式很神奇的不會爛掉，但是當 porting 到其它「正常」的平台後，就爛掉了。</p>
]]></content:encoded>
	</item>
</channel>
</rss>
