offsetof
定义:offsetof在linux内核的include/linux/stddef.h中定义
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#当前目录 | |
current_path=$(pwd) | |
#workspace绝对路径 | |
workspace_path=$(pwd)/Example | |
#workspace | |
build_workspace=$(echo $(basename $workspace_path/*.xcworkspace)) | |
#target 和workspace同名 |
Debugger commands: | |
apropos -- List debugger commands related to a word or subject. | |
breakpoint -- Commands for operating on breakpoints (see 'help b' for | |
shorthand.) | |
bugreport -- Commands for creating domain-specific bug reports. | |
command -- Commands for managing custom LLDB commands. | |
disassemble -- Disassemble specified instructions in the current | |
target. Defaults to the current function for the | |
current thread and stack frame. |
#include <sys/sysctl.h> | |
+ (NSString *) platform { | |
size_t size; | |
sysctlbyname("hw.machine", NULL, &size, NULL, 0); | |
char *machine = malloc(size); | |
sysctlbyname("hw.machine", machine, &size, NULL, 0); | |
NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding]; | |
free(machine); | |
return platform; |
// | |
// MyObject.h | |
// BlockDemo | |
// | |
// Created by wanyakun on 16/8/1. | |
// Copyright © 2016年 com.ucaiyuan. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
// | |
// DoubleLink.c | |
// DataStructureAndAlgorithm | |
// | |
// Created by wanyakun on 2016/10/27. | |
// Copyright © 2016年 com.ucaiyuan. All rights reserved. | |
// | |
#include "DoubleLink.h" | |
#include <stdlib.h> |
首先,串行并行针对的是队列,同步异步针对的是任务;如果觉得队列和任务不太好理解咱们可以打个比方,假设一个应用程序是一个工厂,那队列就是里面的流水线以及线上的工人,而流水线上的工人所要处理的产品就是所谓的任务。
串行,并行
系统会给每个应用自动分配两个队列:
dispatch_get_main_queue() 串行队列 处理UI,也可以叫串行主队列,这个队列会排在主线程中。
dispatch_get_global_queue(优先级, 扩展)并行队列。
// | |
// NSObject+Swizzle.h | |
// CrashDemo | |
// | |
// Created by wanyakun on 16/7/5. | |
// Copyright © 2016年 com.ucaiyuan. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |