Skip to content

Instantly share code, notes, and snippets.

@miiiiiin
miiiiiin / ConcurrentMap.swift
Created March 23, 2022 08:34 — forked from dabrahams/ConcurrentMap.swift
Concurrent Map Implementations, Benchmarked
// See commentary below this gist.
import Foundation
import QuartzCore
// Implementation from https://talk.objc.io/episodes/S01E90-concurrent-map
public final class ThreadSafe<A> {
var _value: A
let queue = DispatchQueue(label: "ThreadSafe")
init(_ value: A) { self._value = value }