zoukankan      html  css  js  c++  java
  • 自定义NSOperation

    自定义操作:

    -(void)customOperation

    {

        //创建队列

        NSOperationQueue *queue = [[NSOperationQueue alloc]init];

        

        //封装操作

        XMGOperation *op = [[XMGOperation alloc]init];//自定义NSOperation,执行的任务在自定义类的main方法中执行。

        

        //添加到队列

        [queue addOperation:op];

        self.queue = queue;

    }

     

    取消操作  [self.queue cancelAllOperations];

    在自定义的XMGOperation中重写main方法,在main方法里执行需要的任务。 通过在该方法中判断

      if (self.cancelled) {

            return;

        }

    判断任务是否取消。

  • 相关阅读:
    BGP community和联邦实验
    BGP RR的设计原则
    BGP不可比较的AS间的度量问题的解决办法
    BGP理解错误的部署RR造成的环路
    BGP数据结构表
    BGP RR的环路避免机制
    BGP Lab RR & Loop (1)
    Lab BGP Summary
    70、对象复用的了解,零拷贝的了解
    66、malloc、realloc、calloc的区别
  • 原文地址:https://www.cnblogs.com/dashengios/p/10421297.html
Copyright © 2011-2022 走看看