{"id":1347,"date":"2024-08-06T21:15:18","date_gmt":"2024-08-06T13:15:18","guid":{"rendered":"http:\/\/codermr.com\/?p=1347"},"modified":"2024-08-06T21:42:59","modified_gmt":"2024-08-06T13:42:59","slug":"non_blocking_async","status":"publish","type":"post","link":"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/","title":{"rendered":"\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">\u975e\u963b\u585e<\/h1>\n\n\n\n<p>\u975e\u963b\u585e\uff0c\u5c31\u662f\u5f53\u4e00\u4e2a\u4efb\u52a1\u6b63\u5728\u6267\u884c\u7684\u65f6\u5019\uff0c\u5141\u8bb8\u7a0b\u5e8f\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u4efb\u52a1\uff0c\u800c\u4e0d\u7528\u7b49\u5f85\u8fd9\u4e2a\u4efb\u52a1\u6267\u884c\u5b8c\u6bd5\u3002<\/p>\n\n\n\n<p>Non-blocking refers to the ability of a system, program, or piece of code to continue executing without being halted by certain operations or tasks. This concept is crucial in concurrent and parallel computing, where multiple tasks or threads need to run simultaneously without waiting for each other to complete. Here&#8217;s a breakdown of how to comprehend non-blocking:<\/p>\n\n\n\n<p><strong>Basic Definition<\/strong>:<\/p>\n\n\n\n<ul>\n<li><strong>Blocking<\/strong>: When an operation must wait for a certain condition or event to complete before proceeding, it is considered blocking. For example, reading from a file might block a program until the read operation is complete.<\/li>\n\n\n\n<li><strong>Non-Blocking<\/strong>: A non-blocking operation <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">allows the program to continue executing other tasks while the operation is still in progress<\/mark><\/strong>. The program does not wait for the operation to complete before moving on.<\/li>\n<\/ul>\n\n\n\n<p><strong>Examples in Different Contexts<\/strong>:<\/p>\n\n\n\n<ul>\n<li><strong>Networking<\/strong>: In network programming, <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">non-blocking I\/O<\/mark> allows a program to initiate a network request and then continue doing other work while waiting for the response. This is opposed to blocking I\/O, where the program would pause execution until the network request is complete.<\/li>\n\n\n\n<li><strong>User Interfaces<\/strong>: In graphical user interfaces (GUIs), non-blocking is essential to keep the interface responsive. For example, when a user clicks a button to start a long-running task, a non-blocking implementation would allow the user to continue interacting with the interface while the task runs in the background.<\/li>\n\n\n\n<li><strong>Multithreading<\/strong>: In concurrent programming, non-blocking algorithms allow multiple threads to operate on shared data without causing the threads to wait for one another. <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"><strong>This is often achieved using atomic operations and lock-free data structures\uff08\u8fd9\u901a\u5e38\u662f\u4f7f\u7528\u539f\u5b50\u64cd\u4f5c\u548c\u65e0\u9501\u6570\u636e\u7ed3\u6784\u6765\u5b9e\u73b0\u7684\uff09<\/strong><\/mark>.<\/li>\n<\/ul>\n\n\n\n<p><strong>Benefits<\/strong>:<\/p>\n\n\n\n<ul>\n<li><strong>Responsiveness<\/strong>: Non-blocking operations improve the responsiveness of applications, especially in environments where delays are unacceptable (e.g., real-time systems, user interfaces).<\/li>\n\n\n\n<li><strong>Efficiency<\/strong>: They can lead to better utilization of system resources, as the system can perform other useful work while waiting for an operation to complete.<\/li>\n<\/ul>\n\n\n\n<p><strong>Common Techniques<\/strong>:<\/p>\n\n\n\n<ul>\n<li><strong>Callbacks<\/strong>: A function is passed as an argument and is called once the operation completes.<\/li>\n\n\n\n<li><strong>Promises\/Futures<\/strong>: These represent a value that may be available at some point in the future, allowing the program to continue executing and handle the value when it becomes available.<\/li>\n\n\n\n<li><strong>Async\/Await<\/strong>: Modern programming languages offer async\/await syntax to write non-blocking code in a more readable and manageable way.<\/li>\n<\/ul>\n\n\n\n<p>\u4e0b\u9762\u901a\u8fc7\u4e00\u4e2a\u4f8b\u5b50\u6765\u8bf4\u660e\uff0c\u4f60\u4e00\u4e0b\u5b50\u5c31\u660e\u767d\u4e86\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import asyncio\n\nasync def non_blocking_task():\n    print(\"Task started\")\n    await asyncio.sleep(2)  # Simulate a non-blocking delay\n    print(\"Task completed\")\n\nasync def main():\n    print(\"Main started\")\n    task = asyncio.create_task(non_blocking_task())\n    print(\"Main continues to run\")\n    await task  # Wait for the task to complete\n    print(\"Main completed\")\n\nasyncio.run(main())\n<\/code><\/pre>\n\n\n\n<p>\u770b\u4e0a\u9762\u7a0b\u5e8f\uff0c\u4f60\u5148\u4e0d\u8981\u8003\u8651\u7ebf\u7a0b\u4ec0\u4e48\u7684\uff0cmain \u65b9\u6cd5\u91cc\u8c03\u7528\u4e86 <code>non_blocking_task()<\/code> \u90a3\u4e48\u7a0b\u5e8f\u5c31\u4f1a\u6267\u884c <code>non_blocking_task()<\/code> \u65b9\u6cd5\uff0c\u6267\u884c\u5230 <code>await asyncio.sleep(2)<\/code> \u65f6\u7a0b\u5e8f\u8fd4\u56de\uff0c\u7ee7\u7eed\u6267\u884c main \u65b9\u6cd5\u91cc\u5176\u4ed6\u4ee3\u7801\uff0c\u7b49 <code>await asyncio.sleep(2)<\/code> \u6267\u884c\u5b8c\u6bd5\uff0c\u7a0b\u5e8f\u5728\u7ee7\u7eed\u6267\u884c <code>print(\"Task completed\") <\/code>\uff0c\u8fd9\u4e2a\u4f8b\u5b50\u5c31\u6f14\u793a\u4e86\u4ec0\u4e48\u201c\u975e\u963b\u585e\u201d\u3002<\/p>\n\n\n\n<p>In this example, <code>asyncio.sleep(2)<\/code> is a non-blocking sleep operation. The main function continues to run while the task is sleeping, demonstrating non-blocking behavior.<\/p>\n\n\n\n<p>Understanding non-blocking is essential for writing efficient and responsive applications, particularly in environments where tasks need to be performed concurrently.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u5f02\u6b65<\/h1>\n\n\n\n<p>The terms &#8220;non-blocking&#8221; and &#8220;asynchronous&#8221; are closely related but are not synonymous. They both deal with the handling of tasks that may take some time to complete, but they do so in slightly different ways. Here\u2019s a breakdown of their differences and relationship:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Non-Blocking<\/h3>\n\n\n\n<p><strong>Definition<\/strong>:<\/p>\n\n\n\n<ul>\n<li>Non-blocking refers to operations that do not halt the execution of the program while waiting for the operation to complete. The program can continue executing other tasks.<\/li>\n<\/ul>\n\n\n\n<p><strong>Characteristics<\/strong>:<\/p>\n\n\n\n<ul>\n<li>The operation returns immediately, even if it hasn\u2019t completed.\uff08<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u64cd\u4f5c\u7acb\u523b\u8fd4\u56de\uff0c\u5373\u4f7f\u5b83\u8fd8\u6ca1\u6709\u5b8c\u6210<\/mark><\/strong>\uff09<\/li>\n\n\n\n<li>Common in I\/O operations, where the program can initiate an operation and immediately proceed without waiting.\uff08<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u901a\u5e38\u5728 I\/O \u64cd\u4f5c\u4e2d\uff0c\u7a0b\u5e8f\u53ef\u4ee5\u7acb\u5373\u5f00\u59cb\u4e00\u4e2a\u64cd\u4f5c\u800c\u4e0d\u540c\u7b49\u5f85\u5b83\u5b8c\u6210<\/mark><\/strong>\uff09<\/li>\n\n\n\n<li>Often achieved using techniques like callbacks, polling, or event loops.\uff08<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u901a\u5e38\u4f7f\u7528\u56de\u8c03\u3001\u6c60\u3001\u4e8b\u4ef6\u5faa\u73af\u5b9e\u73b0<\/mark><\/strong>\uff09<\/li>\n<\/ul>\n\n\n\n<p><strong>Examples<\/strong>:<\/p>\n\n\n\n<ul>\n<li>Non-blocking I\/O: A program initiates a file read operation and can continue processing other tasks while waiting for the read to complete.<\/li>\n\n\n\n<li>Non-blocking algorithms in concurrent programming, such as lock-free data structures.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Asynchronous<\/h3>\n\n\n\n<p><strong>Definition<\/strong>:<\/p>\n\n\n\n<ul>\n<li>Asynchronous refers to the execution of tasks in a way that allows them to run independently of the main program flow. Asynchronous operations often use non-blocking mechanisms, but they include additional structures to manage the completion of tasks.\uff08<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u5f02\u6b65\u6307\u4efb\u52a1\u7684\u6267\u884c\u5141\u8bb8\u5b83\u4eec\u72ec\u7acb\u6267\u884c\uff0c\u5f02\u6b65\u64cd\u4f5c\u901a\u5e38\u4f7f\u7528\u4e86\u201c\u975e\u963b\u585e\u201d\u7684\u673a\u5236\uff0c\u4f46\u5b83\u4eec\u5305\u542b\u4e86\u989d\u5916\u7684\u7ed3\u6784\u6765\u7ba1\u7406\u4efb\u52a1\u7684\u5b8c\u6210<\/mark><\/strong>\uff09<\/li>\n<\/ul>\n\n\n\n<p><strong>Characteristics<\/strong>:<\/p>\n\n\n\n<ul>\n<li>Typically involves a higher level of <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">abstraction <\/mark><\/strong>than non-blocking.\uff08<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u901a\u5e38\u6d89\u53ca\u6bd4\u975e\u963b\u585e\u66f4\u9ad8\u7ea7\u522b\u7684\u62bd\u8c61\u3002<\/mark>\uff09<\/li>\n\n\n\n<li>Uses constructs like futures, promises, and async\/await to handle the results of operations that will complete at some point in the future.<\/li>\n\n\n\n<li>Asynchronous programming is often used to handle I\/O-bound and high-latency operations efficiently.<\/li>\n<\/ul>\n\n\n\n<p><strong>Examples<\/strong>:<\/p>\n\n\n\n<ul>\n<li>Asynchronous I\/O: Similar to non-blocking I\/O, but uses constructs like async\/await to manage the flow.<\/li>\n\n\n\n<li>Asynchronous functions in programming languages like Python (using <code>async def<\/code> and <code>await<\/code>), JavaScript (using <code>async<\/code> and <code>await<\/code>), and C#.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Relationship<\/h3>\n\n\n\n<ol>\n<li><strong>Overlap<\/strong>:\n<ul>\n<li>Asynchronous operations are often implemented using non-blocking techniques. For instance, an asynchronous read operation might be non-blocking and use a callback or promise to handle the completion.\uff08<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u5f02\u6b65\u901a\u5e38\u4f7f\u7528\u4e86\u975e\u963b\u585e\u7684\u6280\u672f<\/mark><\/strong>\uff09<\/li>\n\n\n\n<li>Both aim to improve the efficiency and responsiveness of applications by allowing other tasks to run while waiting for an operation to complete.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Abstraction Level<\/strong>:\n<ul>\n<li>Non-blocking is a lower-level concept focused on immediate return of control to the program.\uff08<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u975e\u963b\u585e\u662f\u4e00\u4e2a\u8f83\u4f4e\u7ea7\u522b\u7684\u6982\u5ff5\uff0c\u4fa7\u91cd\u4e8e\u7acb\u5373\u5c06\u63a7\u5236\u6743\u8fd4\u56de\u7ed9\u7a0b\u5e8f<\/mark><\/strong>\uff09<\/li>\n\n\n\n<li>Asynchronous programming provides a higher-level abstraction for managing the lifecycle and completion of tasks, often making non-blocking operations easier to work with.\uff08<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u5f02\u6b65\u7f16\u7a0b\u4e3a\u7ba1\u7406\u751f\u547d\u5468\u671f\u548c\u4efb\u52a1\u7684\u5b8c\u6210\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u522b\u7684\u62bd\u8c61\uff0c\u901a\u5e38\u4f7f\u975e\u963b\u585e\u64cd\u4f5c\u66f4\u6613\u4e8e\u4f7f\u7528<\/mark><\/strong>\uff09<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Example in Python<\/h3>\n\n\n\n<p>Here\u2019s how non-blocking and asynchronous concepts can be seen in Python:<\/p>\n\n\n\n<p><strong>Non-Blocking I\/O with Callbacks<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import socket\nimport selectors\n\nsel = selectors.DefaultSelector()\n\ndef read(conn, mask):\n    data = conn.recv(1000)  # Should be ready\n    if data:\n        print('Received', repr(data))\n    else:\n        print('Closing', conn)\n        sel.unregister(conn)\n        conn.close()\n\nsock = socket.socket()\nsock.connect(('example.com', 80))\nsock.setblocking(False)\nsel.register(sock, selectors.EVENT_READ, read)\n\n# Event loop\nwhile True:\n    events = sel.select()\n    for key, mask in events:\n        callback = key.data\n        callback(key.fileobj, mask)\n<\/code><\/pre>\n\n\n\n<p><strong>Asynchronous with Asyncio<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import asyncio\n\nasync def fetch_data():\n    print(\"Fetching started\")\n    await asyncio.sleep(2)  # Simulate I\/O operation\n    print(\"Fetching completed\")\n\nasync def main():\n    print(\"Main started\")\n    await fetch_data()\n    print(\"Main completed\")\n\nasyncio.run(main())\n<\/code><\/pre>\n\n\n\n<p>In the first example, <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">non-blocking I\/O is achieved using selectors and callbacks<\/mark><\/strong>. In the second example, <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">asynchronous programming with <code>asyncio<\/code> provides a higher-level abstraction<\/mark><\/strong> that simplifies the handling of asynchronous tasks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u975e\u963b\u585e \u975e\u963b\u585e\uff0c\u5c31\u662f\u5f53\u4e00\u4e2a\u4efb\u52a1\u6b63\u5728\u6267\u884c\u7684\u65f6\u5019\uff0c\u5141\u8bb8\u7a0b\u5e8f\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u4efb\u52a1\uff0c\u800c\u4e0d\u7528\u7b49\u5f85\u8fd9\u4e2a\u4efb\u52a1\u6267\u884c\u5b8c\u6bd5\u3002 Non-&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1354,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[56],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f - \u7801\u5148\u751f\u7684\u535a\u5ba2<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f - \u7801\u5148\u751f\u7684\u535a\u5ba2\" \/>\n<meta property=\"og:description\" content=\"\u975e\u963b\u585e \u975e\u963b\u585e\uff0c\u5c31\u662f\u5f53\u4e00\u4e2a\u4efb\u52a1\u6b63\u5728\u6267\u884c\u7684\u65f6\u5019\uff0c\u5141\u8bb8\u7a0b\u5e8f\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u4efb\u52a1\uff0c\u800c\u4e0d\u7528\u7b49\u5f85\u8fd9\u4e2a\u4efb\u52a1\u6267\u884c\u5b8c\u6bd5\u3002 Non-...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/\" \/>\n<meta property=\"og:site_name\" content=\"\u7801\u5148\u751f\u7684\u535a\u5ba2\" \/>\n<meta property=\"article:published_time\" content=\"2024-08-06T13:15:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-06T13:42:59+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/08\/non-bloking11.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"340\" \/>\n\t<meta property=\"og:image:height\" content=\"339\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"\u7801\u5148\u751f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/mrcode2021\" \/>\n<meta name=\"twitter:site\" content=\"@mrcode2021\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u7801\u5148\u751f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/\"},\"author\":{\"name\":\"\u7801\u5148\u751f\",\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"headline\":\"\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f\",\"datePublished\":\"2024-08-06T13:15:18+00:00\",\"dateModified\":\"2024-08-06T13:42:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/\"},\"wordCount\":827,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"keywords\":[\"react\"],\"articleSection\":[\"JAVA\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/\",\"url\":\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/\",\"name\":\"\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f - \u7801\u5148\u751f\u7684\u535a\u5ba2\",\"isPartOf\":{\"@id\":\"http:\/\/codermr.com\/#website\"},\"datePublished\":\"2024-08-06T13:15:18+00:00\",\"dateModified\":\"2024-08-06T13:42:59+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/codermr.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/codermr.com\/#website\",\"url\":\"http:\/\/codermr.com\/\",\"name\":\"\u7801\u5148\u751f\u7684\u535a\u5ba2\",\"description\":\"\u6b22 \u8fce \u4e0b \u8f7d \u6211 \u5f00 \u53d1 \u7684 \u5404 \u7aef \u8f6f \u4ef6 \u548c APP\",\"publisher\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/codermr.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\",\"name\":\"\u7801\u5148\u751f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg\",\"contentUrl\":\"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg\",\"width\":400,\"height\":400,\"caption\":\"\u7801\u5148\u751f\"},\"logo\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/codermr.com\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/mrcode2021\"],\"url\":\"http:\/\/codermr.com\/index.php\/author\/coderma\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f - \u7801\u5148\u751f\u7684\u535a\u5ba2","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/","og_locale":"zh_CN","og_type":"article","og_title":"\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f - \u7801\u5148\u751f\u7684\u535a\u5ba2","og_description":"\u975e\u963b\u585e \u975e\u963b\u585e\uff0c\u5c31\u662f\u5f53\u4e00\u4e2a\u4efb\u52a1\u6b63\u5728\u6267\u884c\u7684\u65f6\u5019\uff0c\u5141\u8bb8\u7a0b\u5e8f\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u4efb\u52a1\uff0c\u800c\u4e0d\u7528\u7b49\u5f85\u8fd9\u4e2a\u4efb\u52a1\u6267\u884c\u5b8c\u6bd5\u3002 Non-...","og_url":"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/","og_site_name":"\u7801\u5148\u751f\u7684\u535a\u5ba2","article_published_time":"2024-08-06T13:15:18+00:00","article_modified_time":"2024-08-06T13:42:59+00:00","og_image":[{"width":340,"height":339,"url":"http:\/\/codermr.com\/wp-content\/uploads\/2024\/08\/non-bloking11.jpg","type":"image\/jpeg"}],"author":"\u7801\u5148\u751f","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/mrcode2021","twitter_site":"@mrcode2021","twitter_misc":{"\u4f5c\u8005":"\u7801\u5148\u751f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/#article","isPartOf":{"@id":"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/"},"author":{"name":"\u7801\u5148\u751f","@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"headline":"\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f","datePublished":"2024-08-06T13:15:18+00:00","dateModified":"2024-08-06T13:42:59+00:00","mainEntityOfPage":{"@id":"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/"},"wordCount":827,"commentCount":0,"publisher":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"keywords":["react"],"articleSection":["JAVA"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/","url":"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/","name":"\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f - \u7801\u5148\u751f\u7684\u535a\u5ba2","isPartOf":{"@id":"http:\/\/codermr.com\/#website"},"datePublished":"2024-08-06T13:15:18+00:00","dateModified":"2024-08-06T13:42:59+00:00","breadcrumb":{"@id":"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/codermr.com\/index.php\/2024\/08\/06\/non_blocking_async\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/codermr.com\/"},{"@type":"ListItem","position":2,"name":"\u600e\u4e48\u7406\u89e3\u975e\u963b\u585e\uff08non-blocking\uff09\u548c\u5f02\u6b65\uff1f"}]},{"@type":"WebSite","@id":"http:\/\/codermr.com\/#website","url":"http:\/\/codermr.com\/","name":"\u7801\u5148\u751f\u7684\u535a\u5ba2","description":"\u6b22 \u8fce \u4e0b \u8f7d \u6211 \u5f00 \u53d1 \u7684 \u5404 \u7aef \u8f6f \u4ef6 \u548c APP","publisher":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/codermr.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf","name":"\u7801\u5148\u751f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/codermr.com\/#\/schema\/person\/image\/","url":"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg","contentUrl":"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg","width":400,"height":400,"caption":"\u7801\u5148\u751f"},"logo":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/codermr.com","https:\/\/twitter.com\/https:\/\/twitter.com\/mrcode2021"],"url":"http:\/\/codermr.com\/index.php\/author\/coderma\/"}]}},"_links":{"self":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1347"}],"collection":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/comments?post=1347"}],"version-history":[{"count":4,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1347\/revisions"}],"predecessor-version":[{"id":1355,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1347\/revisions\/1355"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/media\/1354"}],"wp:attachment":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/media?parent=1347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/categories?post=1347"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/tags?post=1347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}