Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

说一下什么是Block? #36

Open
tbfungeek opened this issue Jan 7, 2020 · 0 comments
Open

说一下什么是Block? #36

tbfungeek opened this issue Jan 7, 2020 · 0 comments

Comments

@tbfungeek
Copy link
Owner

Block是将函数及其上下文封装起来的对象,它的结构如下所示:

struct Block_layout {    
    void *isa;    
    int flags;    
    int reserved;   
    void (*invoke)(void *, ...);                       //Block内部可执行的部分
   struct Block_descriptor *descriptor;    //Block描述
   /* 捕获的上下文变量 */
};

struct Block_descriptor {    
    unsigned long int reserved;    
    unsigned long int size;   
    void (*copy)(void *dst, void *src);    
    void (*dispose)(void *);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant