上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页
摘要: 1、编写测试代码 并将其转换成c++代码 查看具体实现 进入main.m所在目录 执行 xcrun -sdk iphoneos clang -arch arm64 -rewrite-objc main.m 或者 xcrun -sdk iphoneos clang -arch arm64 -rewri 阅读全文
posted @ 2020-02-16 21:25 ZhangShengjie 阅读(131) 评论(0) 推荐(0)
摘要: pthread_rwlock:读写锁 #import "ViewController.h" #import <Pthread.h> @interface ViewController () @property (nonatomic,assign) pthread_rwlock_t lock; @en 阅读全文
posted @ 2020-02-11 23:01 ZhangShengjie 阅读(757) 评论(0) 推荐(0)
摘要: atomic用于保证属性setter、getter的原子性操作,相当于在getter和setter内部加了线程同步的锁 可以参考源码objc4的objc-accessors.mm 它并不能保证使用属性的过程是线程安全的、比如声明一个atomic数组 同时几个线程往数组加东西 atomic 大多用在M 阅读全文
posted @ 2020-02-11 21:31 ZhangShengjie 阅读(189) 评论(0) 推荐(0)
摘要: #import "ViewController.h" @interface ViewController () @property (nonatomic,assign) int ticket; @end @implementation ViewController - (void)viewDidLo 阅读全文
posted @ 2020-02-10 18:42 ZhangShengjie 阅读(436) 评论(0) 推荐(0)
摘要: #define kSemaphoreBegin \ static dispatch_semaphore_t semaphore; \ static dispatch_once_t onceToken; \ dispatch_once(&onceToken, ^{ \ semaphore = disp 阅读全文
posted @ 2020-02-10 18:38 ZhangShengjie 阅读(902) 评论(0) 推荐(0)
摘要: #import "ViewController.h" #import <pthread.h> @interface ViewController () @property (nonatomic, strong) NSCondition *lock; @property (nonatomic, str 阅读全文
posted @ 2020-02-09 23:08 ZhangShengjie 阅读(403) 评论(0) 推荐(0)
摘要: 线程同步的本质是每一条线程的同步都是按顺序的 #import "ViewController.h" #import <libkern/OSAtomic.h> @interface ViewController () @property (nonatomic,assign) int ticket; / 阅读全文
posted @ 2020-02-07 22:55 ZhangShengjie 阅读(715) 评论(0) 推荐(0)
摘要: - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ dispatch_queue_t queue = dispatch_get_global_queue(0, 0); dispatch_async( 阅读全文
posted @ 2020-02-06 16:36 ZhangShengjie 阅读(348) 评论(0) 推荐(0)
摘要: // dispatch_queue_t queue = dispatch_get_global_queue(0, 0); //全局队列 dispatch_queue_t queue3 = dispatch_queue_create("queu3", DISPATCH_QUEUE_CONCURRENT 阅读全文
posted @ 2020-01-20 17:18 ZhangShengjie 阅读(488) 评论(0) 推荐(0)
摘要: 1、最近做项目、文件存储服务器是用的亚马逊的、如果直接访问、下载其资源速度很慢、所以需要在网络请求的时候添加一个代理、加速网络访问 2、代理服务器是一个HTTPS 的一个服务器 3、思路、解决方案、利用运行时机制(添加分类NSURLSession+Change)针对 NSURLSession 初始化 阅读全文
posted @ 2020-01-13 17:35 ZhangShengjie 阅读(1648) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页