{"id":227,"date":"2022-01-24T20:22:29","date_gmt":"2022-01-24T12:22:29","guid":{"rendered":"https:\/\/www.fanhangame.ltd\/?p=227"},"modified":"2024-04-04T22:19:14","modified_gmt":"2024-04-04T14:19:14","slug":"ios%e7%ba%bf%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.fanhangame.ltd\/?p=227","title":{"rendered":"ios\u7ebf\u7a0b"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>dispatch_queue_t queue = dispatch_queue_create(\"me.tutuge.test.gcd\", DISPATCH_QUEUE_SERIAL);\r\n\/\/\u63d0\u4ea4\u7b2c\u4e00\u4e2ablock\uff0c\u5ef6\u65f65\u79d2\u6253\u5370\u3002\r\ndispatch_async(queue, ^{\r\n    &#91;NSThread sleepForTimeInterval:5];\r\n    NSLog(@\"After 5 seconds...\");\r\n});\r\n\/\/\u63d0\u4ea4\u7b2c\u4e8c\u4e2ablock\uff0c\u4e5f\u662f\u5ef6\u65f65\u79d2\u6253\u5370\r\ndispatch_async(queue, ^{\r\n    &#91;NSThread sleepForTimeInterval:5];\r\n    NSLog(@\"After 5 seconds again...\");\r\n});\r\n\/\/\u5ef6\u65f6\u4e00\u79d2\r\nNSLog(@\"sleep 1 second...\");\r\n&#91;NSThread sleepForTimeInterval:1];\r\n\/\/\u6302\u8d77\u961f\u5217                        \r\nNSLog(@\"suspend...\");\r\ndispatch_suspend(queue);\r\n\/\/\u5ef6\u65f610\u79d2                \r\nNSLog(@\"sleep 10 second...\");\r\n&#91;NSThread sleepForTimeInterval:10];\r\n\/\/\u6062\u590d\u961f\u5217            \r\nNSLog(@\"resume...\");\r\ndispatch_resume(queue);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":1067,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-227","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","h-entry","h-as-article"],"_links":{"self":[{"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=\/wp\/v2\/posts\/227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=227"}],"version-history":[{"count":1,"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":228,"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=\/wp\/v2\/posts\/227\/revisions\/228"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=\/wp\/v2\/media\/1067"}],"wp:attachment":[{"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fanhangame.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}