Skip to content

Instantly share code, notes, and snippets.

View yxztj's full-sized avatar
🎯
Focusing

Jason Yu yxztj

🎯
Focusing
  • Facebook
  • Menlo Park
View GitHub Profile
@yxztj
yxztj / repro.swift
Created June 4, 2018 02:30
Wrong size for Chinese text
import UIKit
import PlaygroundSupport
let paragraph = NSMutableParagraphStyle()
paragraph.lineSpacing = 20
// the issue won't report with PingFangSC-Regular font
//let font = UIFont(name: "PingFangSC-Regular", size: 18)!
// setting to ".SFUIText" would lead to reproductive
let font = UIFont(name: ".SFUIText", size: 18)!
@yxztj
yxztj / deadlock.swift
Last active March 22, 2019 08:38
concurrent execution with nested write lock would cause deadlock
import UIKit
private var imp = pthread_rwlock_t()
func wlock(_ time: Int) {
pthread_rwlock_wrlock(&imp)
print("[\(time)]wlock")
}
func rlock(_ time: Int) {
@yxztj
yxztj / TaskConcurrencyManifesto.md
Last active November 14, 2024 13:55 — forked from lattner/TaskConcurrencyManifesto.md
Swift Concurrency Manifesto 中文翻译