Code Explainers

Code explainers tagged #atomicity

python
import os
import tempfile
from pathlib import Path
from typing import Union

How atomic file writes work in Python

atomicity filesystem durability
Advanced 7 steps
ruby
class ThreadSafeCounter
  def initialize(initial = 0)
    @count = initial
    @mutex = Mutex.new

A thread-safe counter with Mutex in Ruby

concurrency mutex thread-safety
Intermediate 6 steps