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>

                            主站蜘蛛池模板: 医养体检包_公卫随访箱_慢病随访包_家签随访包_随访一体机-济南易享医疗科技有限公司 | 直线模组_滚珠丝杆滑台_模组滑台厂家_万里疆科技 | 纸塑分离机-纸塑分离清洗机设备-压力筛-碎浆机厂家金双联环保 | 好杂志网-首页 | 太空舱_民宿太空舱厂家_移动房屋太空舱价格-豪品建筑 | 立式_复合式_壁挂式智能化电伴热洗眼器-上海达傲洗眼器生产厂家 理化生实验室设备,吊装实验室设备,顶装实验室设备,实验室成套设备厂家,校园功能室设备,智慧书法教室方案 - 东莞市惠森教学设备有限公司 | 红酒招商加盟-葡萄酒加盟-进口红酒代理-青岛枞木酒业有限公司 | uv固化机-丝印uv机-工业烤箱-五金蚀刻机-分拣输送机 - 保定市丰辉机械设备制造有限公司 | 环氧乙烷灭菌器_压力蒸汽灭菌器_低温等离子过氧化氢灭菌器 _低温蒸汽甲醛灭菌器_清洗工作站_医用干燥柜_灭菌耗材-环氧乙烷灭菌器_脉动真空压力蒸汽灭菌器_低温等离子灭菌设备_河南省三强医疗器械有限责任公司 | 杰恒蠕动泵-蠕动泵专业厂家-19年专注蠕动泵 | 世界箱包品牌十大排名,女包小众轻奢品牌推荐200元左右,男包十大奢侈品牌排行榜双肩,学生拉杆箱什么品牌好质量好 - Gouwu3.com | 电池挤压试验机-自行车喷淋-车辆碾压试验装置-深圳德迈盛测控设备有限公司 | 成都装修公司-成都装修设计公司推荐-成都朗煜装饰公司 | 银川美容培训-美睫美甲培训-彩妆纹绣培训-新娘化妆-学化妆-宁夏倍莱妮职业技能培训学校有限公司 临时厕所租赁_玻璃钢厕所租赁_蹲式|坐式厕所出租-北京慧海通 | 武汉不干胶印刷_标签设计印刷_不干胶标签印刷厂 - 武汉不干胶标签印刷厂家 | 临时厕所租赁_玻璃钢厕所租赁_蹲式|坐式厕所出租-北京慧海通 | 在线浊度仪_悬浮物污泥浓度计_超声波泥位计_污泥界面仪_泥水界面仪-无锡蓝拓仪表科技有限公司 | 山东柳店新能源科技有限公司 | 九州网址_专注于提供网址大全分享推广中文网站导航服务 | 厦门ISO认证|厦门ISO9001认证|厦门ISO14001认证|厦门ISO45001认证-艾索咨询专注ISO认证行业 | 电动打包机_气动打包机_钢带捆扎机_废纸打包机_手动捆扎机 | 槽钢冲孔机,槽钢三面冲,带钢冲孔机-山东兴田阳光智能装备股份有限公司 | 钢木实验台-全钢实验台-化验室通风柜-实验室装修厂家-杭州博扬实验设备 | 南溪在线-南溪招聘找工作、找房子、找对象,南溪综合生活信息门户! | 胶水,胶粘剂,AB胶,环氧胶,UV胶水,高温胶,快干胶,密封胶,结构胶,电子胶,厌氧胶,高温胶水,电子胶水-东莞聚力-聚厉胶粘 | 学校用栓剂模,玻璃瓶轧盖钳,小型安瓿熔封机,实验室安瓿熔封机-长沙中亚制药设备有限公司 | 水平垂直燃烧试验仪-灼热丝试验仪-漏电起痕试验仪-针焰试验仪-塑料材料燃烧检测设备-IP防水试验机 | 涡街流量计_LUGB智能管道式高温防爆蒸汽温压补偿计量表-江苏凯铭仪表有限公司 | 润滑油加盟_润滑油厂家_润滑油品牌-深圳市沃丹润滑科技有限公司 琉璃瓦-琉璃瓦厂家-安徽盛阳新型建材科技有限公司 | 净化板-洁净板-净化板价格-净化板生产厂家-山东鸿星新材料科技股份有限公司 | 礼至家居-全屋定制家具_一站式全屋整装_免费量房设计报价 | 避光流动池-带盖荧光比色皿-生化流动比色皿-宜兴市晶科光学仪器 东莞爱加真空科技有限公司-进口真空镀膜机|真空镀膜设备|Polycold维修厂家 | 政府园区专业委托招商平台_助力企业选址项目快速落地_东方龙商务集团 | 2-羟基泽兰内酯-乙酰蒲公英萜醇-甘草查尔酮A-上海纯优生物科技有限公司 | 慈溪麦田广告公司,提供慈溪广告设计。| 脑钠肽-白介素4|白介素8试剂盒-研域(上海)化学试剂有限公司 | 仿真植物|仿真树|仿真花|假树|植物墙 - 广州天昆仿真植物有限公司 | 切铝机-数控切割机-型材切割机-铝型材切割机-【昆山邓氏精密机械有限公司】 | 贴片电感_贴片功率电感_贴片绕线电感_深圳市百斯特电子有限公司 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | SPC工作站-连杆综合检具-表盘气动量仪-内孔缺陷检测仪-杭州朗多检测仪器有限公司 | Maneurop/美优乐压缩机,活塞压缩机,型号规格,技术参数,尺寸图片,价格经销商 |