{"id":5887,"date":"2024-12-21T09:20:42","date_gmt":"2024-12-21T01:20:42","guid":{"rendered":"https:\/\/blog.qdac.cc\/?p=5887"},"modified":"2024-12-21T09:20:43","modified_gmt":"2024-12-21T01:20:43","slug":"%e6%95%99%e7%a8%8b-qworker-%e4%b8%ad%e8%87%aa%e7%94%b1%e6%8e%a7%e5%88%b6%e5%bb%b6%e8%bf%9f%e4%bd%9c%e4%b8%9a%e7%9a%84%e6%89%a7%e8%a1%8c%e6%97%b6%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=5887","title":{"rendered":"[\u6559\u7a0b] QWorker \u4e2d\u81ea\u7531\u63a7\u5236\u5ef6\u8fdf\u4f5c\u4e1a\u7684\u6267\u884c\u65f6\u5e8f"},"content":{"rendered":"\n<p>\u5728 QWorker \u4e2d\uff0c\u6211\u4eec\u4e00\u822c\u4f7f\u7528 Delay \u6765\u5b9e\u73b0\u5b9a\u95f4\u9694\u5ef6\u8fdf\u4f5c\u4e1a\u6267\u884c\u3002\u5982\u679c\u8981\u91cd\u590d\u6267\u884c\uff0c\u53ef\u4ee5\u7b80\u5355\u7684\u8bbe\u7f6e\u8bbe\u7f6e ARepeat \u53c2\u6570\u5373\u53ef\u6309\u7167  ADelay \u6307\u5b9a\u7684\u6307\u5b9a\u5b9a\u65f6\u6267\u884c\u3002\u4f46\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0c\u6211\u4eec\u8981\u6c42\u4f5c\u6765\u7acb\u5373\u6267\u884c\u4e00\u6b21\u540e\uff0c\u540e\u7eed\u518d\u6309\u7167\u6307\u5b9a\u7684\u95f4\u9694\u6267\u884c\uff0c\u76f4\u63a5\u4f7f\u7528 Delay \u663e\u7136\u65e0\u6cd5\u8fbe\u5230\u76ee\u7684\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u6211\u4eec\u7ed9\u51fa\u4e00\u4e2a\u4f8b\u5b50\uff0c\u4f7f\u7528 Delay \u6765\u5b9e\u73b0\u8fd9\u4e00\u9700\u6c42\u3002<\/p>\n\n\n\n<p>\u7b2c\u4e00\u6b65\uff1a\u6211\u4eec\u4f7f\u7528 Post \u6765\u63d0\u4ea4\u4e00\u4e2a\u7acb\u5373\u6267\u884c\u7684\u4f5c\u4e1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>Workers.Post(DoJob,nil);<\/code><\/code><\/pre>\n\n\n\n<p>\u7b2c\u4e8c\u6b65\uff1a\u6211\u4eec\u5728 DoJob \u51fd\u6570\u6267\u884c\u5b8c\u6210\u65f6\uff0c\u8c03\u7528 Delay \u6765\u5ef6\u8fdf15\u79d2\u6267\u884c\u4e0b\u4e00\u6b21\u64cd\u4f5c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>procedure DoJob(AJob:PQJob);\nbegin\n...\nWorkers.Delay(DoJob,15*Q1Second,nil);\nend;<\/code><\/pre>\n\n\n\n<p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u91cc\uff0c\u6211\u4eec\u5b8c\u6210\u53ef\u4ee5\u5728\u7b2c\u4e8c\u6b65\u4e2d\uff0c\u4fee\u6539\u4ee3\u7801\uff0c\u6839\u636e\u5f53\u524d\u72b6\u6001\uff0c\u52a8\u6001\u63a7\u5236\u5ef6\u8fdf\u7684\u65f6\u95f4\uff0c\u4ece\u800c\u8fbe\u5230\u52a8\u6001\u63a7\u5236\u5ef6\u8fdf\u95f4\u9694\u7684\u76ee\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>procedure DoJob(AJob:PQJob);\nbegin\n...\nif \u6761\u4ef61\u6210\u7acb then\n    Workers.Delay(DoJob,5*Q1Second,nil);\nelse\n    Workers.Delay(DoJob,15*Q1Second,nil);\nend;<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 QWorker \u4e2d\uff0c\u6211\u4eec\u4e00\u822c\u4f7f\u7528 D [&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,6,603],"tags":[],"class_list":["post-5887","post","type-post","status-publish","format-standard","hentry","category-delphi","category-qworker","category-603"],"views":1086,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5887","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=5887"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5887\/revisions"}],"predecessor-version":[{"id":5888,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5887\/revisions\/5888"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}