pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

      <small id='UACsu'></small><noframes id='UACsu'>

        <tfoot id='UACsu'></tfoot>
        <legend id='UACsu'><style id='UACsu'><dir id='UACsu'><q id='UACsu'></q></dir></style></legend>
        • <bdo id='UACsu'></bdo><ul id='UACsu'></ul>
      1. <i id='UACsu'><tr id='UACsu'><dt id='UACsu'><q id='UACsu'><span id='UACsu'><b id='UACsu'><form id='UACsu'><ins id='UACsu'></ins><ul id='UACsu'></ul><sub id='UACsu'></sub></form><legend id='UACsu'></legend><bdo id='UACsu'><pre id='UACsu'><center id='UACsu'></center></pre></bdo></b><th id='UACsu'></th></span></q></dt></tr></i><div class="ppf7jvr" id='UACsu'><tfoot id='UACsu'></tfoot><dl id='UACsu'><fieldset id='UACsu'></fieldset></dl></div>

        暫停計時器上的 dispatch_source_cancel 導致 EXC_BAD_I

        dispatch_source_cancel on a suspended timer causes EXC_BAD_INSTRUCTION(暫停計時器上的 dispatch_source_cancel 導致 EXC_BAD_INSTRUCTION)

            <tfoot id='TP6KL'></tfoot>

            <small id='TP6KL'></small><noframes id='TP6KL'>

            <legend id='TP6KL'><style id='TP6KL'><dir id='TP6KL'><q id='TP6KL'></q></dir></style></legend>
            • <bdo id='TP6KL'></bdo><ul id='TP6KL'></ul>
                  <tbody id='TP6KL'></tbody>

                1. <i id='TP6KL'><tr id='TP6KL'><dt id='TP6KL'><q id='TP6KL'><span id='TP6KL'><b id='TP6KL'><form id='TP6KL'><ins id='TP6KL'></ins><ul id='TP6KL'></ul><sub id='TP6KL'></sub></form><legend id='TP6KL'></legend><bdo id='TP6KL'><pre id='TP6KL'><center id='TP6KL'></center></pre></bdo></b><th id='TP6KL'></th></span></q></dt></tr></i><div class="jpf77rn" id='TP6KL'><tfoot id='TP6KL'></tfoot><dl id='TP6KL'><fieldset id='TP6KL'></fieldset></dl></div>

                  本文介紹了暫停計時器上的 dispatch_source_cancel 導致 EXC_BAD_INSTRUCTION的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  I'm trying to cancel and then release a suspended timer but when I invoke 'dispatch_release' on it, I immediately get EXC_BAD_INSTRUCTION.

                  Is this not a valid set of actions to take on a timer?

                  Timer creation & suspension:

                  @interface SomeClass: NSObject { }
                  @property (nonatomic, assign) dispatch_source_t             timer;
                  @end
                  
                  // Class implementation
                  @implementation SomeClass
                  
                  @synthesize timer = _timer;
                  
                  - (void)startTimer 
                  {
                      dispatch_queue_t globalQ = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
                      self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 
                                                      0, 0, globalQ); 
                  
                      dispatch_time_t startWhen = dispatch_walltime(DISPATCH_TIME_NOW, NSEC_PER_SEC * 1);
                      dispatch_source_set_timer(_timer, startWhen, 1 * NSEC_PER_SEC, 5000ull);
                  
                      dispatch_source_set_event_handler(_timer, ^{
                          // Perform a task 
                  
                          // If a particular amount of time has elapsed, kill this timer
                          if (timeConstraintReached)
                          {
                              // Can I suspend this timer within it's own event handler block?
                              dispatch_suspend(_timer);
                          }
                      });
                  
                      dispatch_resume(_timer);
                  }
                  
                  - (void)resetTimer
                  {
                      dispatch_suspend(_timer);
                  
                      dispatch_source_cancel(_timer);
                  
                      // dispatch_release causes 
                      // 'EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
                      dispatch_release(_timer);
                  
                      self.timer = nil;    
                  }
                  @end
                  

                  Additionally, can I invoke dispatch_suspend within a timer source's event_handler block?

                  Any help would be appreciated.

                  解決方案

                  The reason it crashes is because of this code:

                  void
                  _dispatch_source_xref_release(dispatch_source_t ds)
                  {
                      if (slowpath(DISPATCH_OBJECT_SUSPENDED(ds))) {
                          // Arguments for and against this assert are within 6705399
                          DISPATCH_CLIENT_CRASH("Release of a suspended object");
                      }
                      _dispatch_wakeup(ds);
                      _dispatch_release(ds);
                  }
                  

                  So, you can't release a dispatch_source_t that has been suspended. You probably want to just not suspend it in resetTimer I guess.

                  Whilst I can't find anything in the docs for why they have written it like this (and the comment alludes to the pros and cons being in a radar we'll never see), all I can do is refer to the docs where it says:

                  You can suspend and resume the delivery of dispatch source events temporarily using the dispatch_suspend and dispatch_resume methods. These methods increment and decrement the suspend count for your dispatch object. As a result, you must balance each call to dispatch_suspend with a matching call to dispatch_resume before event delivery resumes.

                  Whilst that doesn't say you can't release a dispatch source that's been suspended, it does say you have to balance each call so I'm assuming it's something along the lines of it's using a dispatch semaphore under-the-hood which have to be balanced before they can be released. That's just my guess though :-).

                  As for "can I invoke dispatch_suspend within a timer source's event_handler block". I'm pretty sure you can, yes, as per the docs for dispatch_suspend:

                  The suspension occurs after completion of any blocks running at the time of the call.

                  這篇關于暫停計時器上的 dispatch_source_cancel 導致 EXC_BAD_INSTRUCTION的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to animate a UIImageview to display fullscreen by tapping on it?(如何通過點擊動畫 UIImageview 以顯示全屏?)
                  To stop segue and show alert(停止 segue 并顯示警報)
                  iOS 5 storyboard, programmatically determine path(iOS 5 故事板,以編程方式確定路徑)
                  Icon already includes gloss effects(圖標已經包含光澤效果)
                  How does UIEdgeInsetsMake work?(UIEdgeInsetsMake 是如何工作的?)
                  UIProgressView and Custom Track and Progress Images (iOS 5 properties)(UIProgressView 和自定義跟蹤和進度圖像(iOS 5 屬性))
                        <bdo id='eHiF1'></bdo><ul id='eHiF1'></ul>

                        <small id='eHiF1'></small><noframes id='eHiF1'>

                      • <i id='eHiF1'><tr id='eHiF1'><dt id='eHiF1'><q id='eHiF1'><span id='eHiF1'><b id='eHiF1'><form id='eHiF1'><ins id='eHiF1'></ins><ul id='eHiF1'></ul><sub id='eHiF1'></sub></form><legend id='eHiF1'></legend><bdo id='eHiF1'><pre id='eHiF1'><center id='eHiF1'></center></pre></bdo></b><th id='eHiF1'></th></span></q></dt></tr></i><div class="v5t7zzh" id='eHiF1'><tfoot id='eHiF1'></tfoot><dl id='eHiF1'><fieldset id='eHiF1'></fieldset></dl></div>
                          <tfoot id='eHiF1'></tfoot>
                            <legend id='eHiF1'><style id='eHiF1'><dir id='eHiF1'><q id='eHiF1'></q></dir></style></legend>
                              <tbody id='eHiF1'></tbody>

                            主站蜘蛛池模板: 滤芯,过滤器,滤油机,贺德克滤芯,精密滤芯_新乡市宇清流体净化技术有限公司 | 在线PH计-氧化锆分析仪-在线浊度仪-在线溶氧仪- 无锡朝达 | NM-02立式吸污机_ZHCS-02软轴刷_二合一吸刷软轴刷-厦门地坤科技有限公司 | 动库网动库商城-体育用品专卖店:羽毛球,乒乓球拍,网球,户外装备,运动鞋,运动包,运动服饰专卖店-正品运动品网上商城动库商城网 - 动库商城 | 双工位钻铣攻牙机-转换工作台钻攻中心-钻铣攻牙机一体机-浙江利硕自动化设备有限公司 | 小型单室真空包装机,食品单室真空包装机-百科 | 菲希尔FISCHER测厚仪-铁素体检测仪-上海吉馨实业发展有限公司 | 美国PARKER齿轮泵,美国PARKER柱塞泵,美国PARKER叶片泵,美国PARKER电磁阀,美国PARKER比例阀-上海维特锐实业发展有限公司二部 | 横河变送器-横河压力变送器-EJA变送器-EJA压力变送器-「泉蕴仪表」 | 浙江华锤电器有限公司_地磅称重设备_防作弊地磅_浙江地磅售后维修_无人值守扫码过磅系统_浙江源头地磅厂家_浙江工厂直营地磅 | 壹作文_中小学生优秀满分作文大全 | 主题班会网 - 安全教育主题班会,各类主题班会PPT模板 | 滚筒烘干机_转筒烘干机_滚筒干燥机_转筒干燥机_回转烘干机_回转干燥机-设备生产厂家 | 石油/泥浆/不锈钢防腐/砂泵/抽砂泵/砂砾泵/吸砂泵/压滤机泵 - 专业石油环保专用泵厂家 | 即用型透析袋,透析袋夹子,药敏纸片,L型涂布棒-上海桥星贸易有限公司 | 北京西风东韵品牌与包装设计公司,创造视觉销售力! | 振动时效_振动时效仪_超声波冲击设备-济南驰奥机电设备有限公司 北京宣传片拍摄_产品宣传片拍摄_宣传片制作公司-现像传媒 | 防弹玻璃厂家_防爆炸玻璃_电磁屏蔽玻璃-四川大硅特玻科技有限公司 | 智能风向风速仪,风速告警仪,数字温湿仪,综合气象仪(气象五要素)-上海风云气象仪器有限公司 | 真空泵厂家_真空泵机组_水环泵_旋片泵_罗茨泵_耐腐蚀防爆_中德制泵 | 密封无忧网 _ 专业的密封产品行业信息网 | 硅胶布|电磁炉垫片|特氟龙胶带-江苏浩天复合材料有限公司 | 北京网站建设首页,做网站选【优站网】,专注北京网站建设,北京网站推广,天津网站建设,天津网站推广,小程序,手机APP的开发。 | 基本型顶空进样器-全自动热脱附解吸仪价格-AutoHS全模式-成都科林分析技术有限公司 | 小小作文网_中小学优秀作文范文大全 | hdpe土工膜-防渗膜-复合土工膜-长丝土工布价格-厂家直销「恒阳新材料」-山东恒阳新材料有限公司 ETFE膜结构_PTFE膜结构_空间钢结构_膜结构_张拉膜_浙江萬豪空间结构集团有限公司 | 珠光砂保温板-一体化保温板-有釉面发泡陶瓷保温板-杭州一体化建筑材料 | 铣刨料沥青破碎机-沥青再生料设备-RAP热再生混合料破碎筛分设备 -江苏锡宝重工 | 石英陶瓷,石英坩埚,二氧化硅陶瓷-淄博百特高新材料有限公司 | 工业插头-工业插头插座【厂家】-温州罗曼电气 | nalgene洗瓶,nalgene量筒,nalgene窄口瓶,nalgene放水口大瓶,浙江省nalgene代理-杭州雷琪实验器材有限公司 | 激光内雕_led玻璃_发光玻璃_内雕玻璃_导光玻璃-石家庄明晨三维科技有限公司 激光内雕-内雕玻璃-发光玻璃 | X光检测仪_食品金属异物检测机_X射线检测设备_微现检测 | 深圳希玛林顺潮眼科医院(官网)│深圳眼科医院│医保定点│香港希玛林顺潮眼科中心连锁品牌 | 防水套管|柔性防水套管|伸缩器|伸缩接头|传力接头-河南伟创管道 防水套管_柔性防水套管_刚性防水套管-巩义市润达管道设备制造有限公司 | 热缩管切管机-超声波切带机-织带切带机-无纺布切布机-深圳市宸兴业科技有限公司 | 破碎机锤头_合金耐磨锤头_郑州宇耐机械工程技术有限公司 | 北京环球北美考试院【官方网站】|北京托福培训班|北京托福培训 | 集装箱展厅-住人集装箱住宿|建筑|房屋|集装箱售楼处-山东锐嘉科技工程有限公司 | 微信小程序定制,广州app公众号商城网站开发公司-广东锋火 | HYDAC过滤器,HYDAC滤芯,现货ATOS油泵,ATOS比例阀-东莞市广联自动化科技有限公司 |