<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Atomic on rustbites</title><link>https://www.rustbites.com/tags/atomic/</link><description>Recent content in Atomic on rustbites</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 29 May 2026 09:16:03 +0200</lastBuildDate><atom:link href="https://www.rustbites.com/tags/atomic/index.xml" rel="self" type="application/rss+xml"/><item><title>169. File::create_new — Atomic 'Create Only If It Doesn't Exist'</title><link>https://www.rustbites.com/posts/bite-169/</link><pubDate>Fri, 29 May 2026 09:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-169/</guid><description>&lt;p&gt;You want to write a config file, a lockfile, or a &amp;ldquo;did we run yet&amp;rdquo; sentinel — but only if it isn&amp;rsquo;t already there. The &lt;code&gt;if path.exists() { … } else { File::create(path) }&lt;/code&gt; pattern looks fine until two processes hit it at the same time. There&amp;rsquo;s a one-line fix sitting in &lt;code&gt;std::fs&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>