{"id":5503,"date":"2022-07-03T22:15:57","date_gmt":"2022-07-03T14:15:57","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=5503"},"modified":"2022-07-20T10:18:56","modified_gmt":"2022-07-20T02:18:56","slug":"%e6%95%99%e7%a8%8b%e4%bd%bf%e7%94%a8-zasyncinvoker-%e8%bf%9b%e8%a1%8c%e5%bc%82%e6%ad%a5%e7%bc%96%e7%a8%8b%e6%95%99%e7%a8%8b%e4%b9%8b%e4%ba%8c%ef%bc%9azasyncinvoker-%e8%a7%a3%e5%86%b3%e4%ba%86","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=5503","title":{"rendered":"[\u6559\u7a0b]\u4f7f\u7528 TZAsync \u8fdb\u884c\u5f02\u6b65\u7f16\u7a0b\u6559\u7a0b\u4e4b\u4e8c\uff1aTZAsync \u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898"},"content":{"rendered":"\n<p>\u5728\u4e0a\u4e00\u8282\u6559\u7a0b\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u6f14\u793a\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u5f02\u6b65\u7f16\u7a0b\u7684\u4f8b\u5b50\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u8bf7\u5927\u5bb6\u9996\u5148\u9605\u8bfb<a href=\"https:\/\/blog.qdac.cc\/?p=5454\"> Delphi  \u81ea\u5e26\u7684\u5f02\u6b65\u7f16\u7a0b\u6a21\u578b<\/a>\uff0c\u90a3\u4e48\u5b83\u5b58\u5728\u7684\u95ee\u9898\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u751f\u547d\u5468\u671f\u95ee\u9898\uff1a<ul><li>\u6ca1\u6709\u548c\u73b0\u6709\u7684\u7ec4\u4ef6\u4f53\u7cfb\u7ed3\u5408\uff0c\u5982\u679c BeginInvoke \u5f15\u53d1\u7684\u5f02\u6b65\u8c03\u7528\uff0c\u8fd4\u56de\u56de\u8c03\u65f6\u5f02\u6b65\u4f5c\u4e1a\u7684\u521b\u5efa\u8005\u88ab\u91ca\u653e\uff0c\u90a3\u4e48\u5982\u679c\u6211\u4eec\u5728\u5176\u4e2d\u8bbf\u95ee\u521b\u5efa\u8005\u76f8\u5173\u7684\u5b9e\u4f8b\uff0c\u5c31\u6709\u53ef\u80fd\u51fa\u73b0\u95ee\u9898\u3002<\/li><li>\u5f02\u6b65\u64cd\u4f5c\u7684\u56de\u8c03\u4e2d\uff0c\u65e0\u6cd5\u68c0\u6d4b\u5230\u4f9d\u8d56\u7684\u5bf9\u8c61\u662f\u5426\u88ab\u91ca\u653e\u6389\uff0c\u5f53\u7136\u5f00\u53d1\u4eba\u5458\u4e5f\u5c31\u6ca1\u6709\u529e\u6cd5\u505a\u8fdb\u4e00\u6b65\u5904\u7406\u3002<\/li><li>\u5f02\u6b65\u64cd\u4f5c\u5982\u679c\u9700\u8981\u8f83\u957f\u7684\u5904\u7406\u65f6\u95f4\uff0cCompletedSynchronously \u64cd\u4f5c\u53ef\u80fd\u957f\u65f6\u95f4\u65e0\u6cd5\u7ed3\u675f\uff0c\u9020\u6210\u7ebf\u7a0b\u88ab\u5361\u6b7b\u5728\u7b49\u5f85\u9636\u6bb5\u3002<\/li><li>Cancel \u7684\u64cd\u4f5c\u662f\u4e0d\u53ef\u9884\u671f\u7684\uff0c\u751a\u81f3\u662f\u5426\u652f\u6301\u4e5f\u53d6\u51b3\u4e8e\u5f02\u6b65\u8c03\u7528\u7684\u5b9e\u73b0\u8005\u3002<\/li><\/ul><\/li><li>\u5b9e\u4f8b\u7ba1\u7406\u95ee\u9898\uff1a<ul><li>\u540c\u4e0a\u9762\u6240\u8bf4\uff0c\u5982\u679c\u8981\u53d6\u6d88\u6216\u7b49\u5f85\u5f02\u6b65\u4f5c\u4e1a\u5b8c\u6210\uff0cBeginInvoke \u7684\u8fd4\u56de\u503c\u5fc5\u9700\u4fdd\u5b58\u4e0b\u6765\uff0c\u8fd9\u5728\u7f16\u7801\u65f6\u4f1a\u5e26\u6765\u989d\u5916\u7684\u590d\u6742\u5ea6<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>TZAsync \u8003\u8651\u5230\u4e86\u8fd9\u4e9b\u95ee\u9898\uff0c\u5e76\u63d0\u4f9b\u4e86\u81ea\u5df1\u7684\u5f02\u6b65\u7f16\u7a0b\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u751f\u547d\u5468\u671f\u95ee\u9898<ul><li>\u548c\u7ec4\u4ef6\u751f\u547d\u5468\u671f\u7ba1\u7406\u76f8\u7ed3\u5408\uff0c\u5728\u7ec4\u4ef6\u91ca\u653e\u524d\uff0c\u4f1a\u81ea\u52a8\u5c06\u76f8\u5e94\u7684\u4f5c\u4e1a\u6807\u8bb0\u4e3a\u53d6\u6d88\u3002<\/li><li>\u7528\u6237\u53ef\u4ee5\u81ea\u7ef4\u62a4\u751f\u547d\u5468\u671f\uff0cIZAsyncInvoker \u521b\u5efa\u65f6\u53ef\u4ee5\u4f20\u9012\u4e00\u4e2a Sender \u53c2\u6570\uff0c\u5728\u9700\u8981\u65f6\uff0c\u8c03\u7528 CancelAsyncInvokes \u6765\u53d6\u6d88 Sender \u5173\u8054\u7684\u4e00\u4e2a\u6216\u5168\u90e8\u5f02\u6b65\u4f5c\u4e1a<\/li><li>\u5982\u679c\u5f02\u6b65\u8c03\u7528\u4e2d\uff0c\u4e0d\u4f9d\u8d56\u5176\u5b83\u8d44\u6e90\uff0c\u5219\u4e0d\u5b58\u5728\u9700\u8981\u7ba1\u7406\u7684\u95ee\u9898\u3002<\/li><li>\u53c2\u6570\u4f20\u9012\u63a8\u8350\u4f7f\u7528\u5c40\u90e8\u53d8\u91cf\u6216\u8005\u662f\u503c\u62f7\u8d1d\uff0c\u4f20\u9012\u6307\u9488\u7c7b\u578b\u65f6\uff0c\u8bf7\u5ba1\u614e\u5904\u7406\uff0c\u4fdd\u969c\u5176\u5728\u5f02\u6b65\u8c03\u7528\u5b8c\u6210\u524d\u7684\u6709\u6548\u6027\uff0c\u6216\u8005\u5728\u6307\u9488\u7c7b\u578b\u7684\u5b9e\u4f8b\u91ca\u653e\u65f6\uff0c\u4e3b\u52a8\u8c03\u7528 CancelAsyncInvokes \u6765\u901a\u77e5\u5f02\u6b65\u4f5c\u4e1a\u4e0d\u5e94\u7ee7\u7eed\u3002<\/li><\/ul><\/li><li>\u5b9e\u4f8b\u7ba1\u7406\u95ee\u9898<ul><li>\u76f4\u63a5\u7528\u5c40\u90e8\u53d8\u91cf\u5c31\u53ef\u4ee5\uff0c\u4e0d\u662f\u5fc5\u9700\u505a\u4e3a\u7c7b\u7684\u6210\u5458\u53d8\u91cf\u6216\u5168\u5c40\u53d8\u91cf\u3002\u53ea\u9700\u8981<strong>\u5728\u5f02\u6b65\u8c03\u7528\u5b8c\u6210\u65f6\uff0c\u8bbe\u7f6e\u5c40\u90e8\u53d8\u91cf\u7684\u503c\u6307\u5411\u7a7a<\/strong>\u6765\u91ca\u653e\u5f15\u7528\u8ba1\u6570\u5c31\u53ef\u4ee5\u3002\u5927\u5bb6\u4e0d\u7528\u62c5\u5fc3\u5728\u5f02\u6b65\u4f5c\u4e1a\u4e2d\u5f15\u7528\u7684\u53d8\u91cf\u4f1a\u5360\u7528\u5f53\u524d\u7ebf\u7a0b\u6808\u7684\u95ee\u9898\uff0c\u8fd9\u4e2a\u95ee\u9898\u6211\u5728<a href=\"https:\/\/blog.qdac.cc\/?p=5435\" data-type=\"post\" data-id=\"5435\">\u8be6\u89e3 Delphi \u7684\u533f\u540d\u51fd\u6570\u5b9e\u73b0<\/a> \u7684\u6587\u7ae0\u4e2d\uff0c\u8fdb\u884c\u4e86\u9610\u8ff0\uff0c\u6709\u5174\u8da3\u7684\u670b\u53cb\u53ef\u4ee5\u56de\u770b\u90a3\u7bc7\u6587\u7ae0\u3002<\/li><\/ul><\/li><li>\u4e0d\u8bd5\u56fe\u786c\u6027\u4e2d\u6b62\u5f02\u6b65\u4f5c\u4e1a\u7684\u6267\u884c\uff0c\u800c\u662f\u7531\u901a\u8fc7\u5224\u65ad IsCanceled \u6807\u5fd7\u4f4d\u6765\u4e2d\u6b62\u4f5c\u4e1a\u7684\u6267\u884c\uff0c\u6765\u4fdd\u8bc1\u4e0d\u4f1a\u8bbf\u95ee\u88ab\u91ca\u653e\u7684\u5bf9\u8c61\uff0c\u4ece\u800c\u907f\u514d\u5185\u5b58\u6cc4\u9732\u7b49\u95ee\u9898\u7684\u53d1\u751f\u3002<\/li><\/ul>\n\n\n\n<p>\u7efc\u4e0a\u6240\u8ff0\uff0c\u867d\u7136 ZAsyncInvoker \u63d0\u4f9b\u4e86\u4e00\u4e2a\u826f\u597d\u7684\u5f02\u6b65\u7f16\u7a0b\u6846\u67b6\uff0c\u4f46\u5b83\u5e76\u4e0d\u80fd\u5e2e\u4f60\u89e3\u51b3\u6240\u6709\u7684\u7684\u95ee\u9898\u3002\u826f\u597d\u7684\u5f02\u6b65\u7f16\u7a0b\u4e60\u60ef\u8fd8\u662f\u5f88\u91cd\u8981\u7684\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u56e0\u4e3a TZAsyncProc \u662f\u4e00\u4e2a\u533f\u540d\u51fd\u6570\uff0c\u76f4\u63a5\u4f7f\u7528\u5c40\u90e8\u53d8\u91cf\u5c31\u80fd\u6ee1\u8db3\u53c2\u6570\u4f20\u9012\u9700\u8981\u3002\u5f53\u7136\u4e5f\u53ef\u4ee5\u7528 TZNamedParams \u7c7b\u578b\u6765\u4f20\u9012\u53c2\u6570\uff0c\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u4e00\u65e6\u7528\u5230\u6307\u9488\u7684\u53c2\u6570\uff0c\u8bf7\u518d\u4e09\u786e\u8ba4\u5176\u751f\u547d\u5468\u671f\u3002<\/li><li>\u5c3d\u91cf\u4e0d\u8981\u8bd5\u56fe\u5f3a\u884c\u4e2d\u6b62\u4e00\u4e2a\u540e\u53f0\u7ebf\u7a0b\u4f5c\u4e1a\uff0c\u56e0\u4e3a\u90a3\u53ef\u80fd\u5e26\u6765\u5185\u5b58\u6cc4\u9732\u3002\u901a\u8fc7\u5728\u5176\u4e2d\u5fc5\u8981\u7684\u4f4d\u7f6e\u52a0\u5165 IsCanceled \u5224\u65ad\uff0c\u53ef\u4ee5\u53ca\u65f6\u7684\u4e2d\u6b62\u540e\u7eed\u4ee3\u7801\u6267\u884c\u5e76\u5b89\u5168\u9000\u51fa\u3002<\/li><li>\u5c3d\u91cf\u907f\u514d\u957f\u65f6\u95f4\u4f5c\u4e1a\uff0c\u5982\u679c\u4e0d\u80fd\u907f\u514d\uff0c\u90a3\u4e48\uff1a<ul><li>\u4e0d\u8981\u5728\u4e3b\u7ebf\u7a0b\u4e2d\u7b49\u5f85\u4f5c\u4e1a\u5b8c\u6210\uff0c\u90a3\u6837\u53ef\u80fd\u4f1a\u9020\u6210\u7a0b\u5e8f\u6ca1\u6709\u54cd\u5e94<\/li><li>\u4e0d\u8981\u5728\u4ee3\u7801\u4e2d\u4e0d\u505a\u4efb\u4f55\u5224\u65ad\u5c31\u8bbf\u95ee\u53ef\u80fd\u968f\u65f6\u88ab\u91ca\u653e\u7684\u8d44\u6e90\uff0c\u90a3\u6837\u53ef\u80fd\u4f1a\u9020\u6210 AV \u9519\u8bef\u3002<\/li><\/ul><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4e0a\u4e00\u8282\u6559\u7a0b\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u6f14\u793a\u4e86\u4e00\u4e2a\u7b80\u5355 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[8],"tags":[],"class_list":["post-5503","post","type-post","status-publish","format-standard","hentry","category-delphi"],"views":1722,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5503"}],"version-history":[{"count":11,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5503\/revisions"}],"predecessor-version":[{"id":5557,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5503\/revisions\/5557"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}