mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-24 20:06:39 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
37 lines
664 B
Swift
37 lines
664 B
Swift
//
|
|
// RWLock.swift
|
|
// SwiftConcurrentCollections
|
|
//
|
|
// Created by Pete Prokop on 09/02/2020.
|
|
// Copyright © 2020 Pete Prokop. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public final class RWLock {
|
|
private var lock: pthread_rwlock_t
|
|
|
|
// MARK: Lifecycle
|
|
deinit {
|
|
pthread_rwlock_destroy(&lock)
|
|
}
|
|
|
|
public init() {
|
|
lock = pthread_rwlock_t()
|
|
pthread_rwlock_init(&lock, nil)
|
|
}
|
|
|
|
// MARK: Public
|
|
public func writeLock() {
|
|
pthread_rwlock_wrlock(&lock)
|
|
}
|
|
|
|
public func readLock() {
|
|
pthread_rwlock_rdlock(&lock)
|
|
}
|
|
|
|
public func unlock() {
|
|
pthread_rwlock_unlock(&lock)
|
|
}
|
|
}
|