Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Jason Yu yxztj

🎯
Focusing
  • Facebook
  • Menlo Park
View GitHub Profile
@yxztj
yxztj / deadlock.swift
Last active Mar 22, 2019
concurrent execution with nested write lock would cause deadlock
View deadlock.swift
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 / repro.swift
Created Jun 4, 2018
Wrong size for Chinese text
View repro.swift
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)!