{"id":884,"date":"2023-03-11T15:02:56","date_gmt":"2023-03-11T08:02:56","guid":{"rendered":"https:\/\/csharptutorial.net\/?page_id=884"},"modified":"2023-03-11T15:38:09","modified_gmt":"2023-03-11T08:38:09","slug":"csharp-deadlock","status":"publish","type":"page","link":"https:\/\/www.csharptutorial.net\/csharp-concurrency\/csharp-deadlock\/","title":{"rendered":"C# Deadlock"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn about the C# deadlock, how it occurs, and how to fix it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to the C# deadlock<\/h2>\n\n\n\n<p>A deadlock happens when two or more <a href=\"https:\/\/csharptutorial.net\/csharp-concurrency\/csharp-thread\/\">threads<\/a> are blocking and waiting for each other to release the <a href=\"https:\/\/csharptutorial.net\/csharp-concurrency\/csharp-lock\/\">locks<\/a> that they need to proceed.<\/p>\n\n\n\n<p>Particularly, each thread is holding onto a lock that the other thread needs, and neither can proceed until it can acquire the lock it&#8217;s waiting for.<\/p>\n\n\n\n<p>For example, suppose you have two threads t1 and t2. Each thread holds a lock on a different shared resource r1 and r2.<\/p>\n\n\n\n<p>Thread t1 needs to access r2 to proceed while thread t2 needs to access r1. Both threads attempt to acquire the resources at the same time. They&#8217;re waiting and blocking each other. As a result, a deadlock occurs.<\/p>\n\n\n\n<p>The following program demonstrates how a deadlock scenario occurs when two threads complete multiple locks:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"C#\" data-shcb-language-slug=\"cs\"><span><code class=\"hljs language-cs\"><span class=\"hljs-keyword\">using<\/span> <span class=\"hljs-keyword\">static<\/span> System.Console;\n\n\n<span class=\"hljs-keyword\">var<\/span> lock1 = <span class=\"hljs-keyword\">new<\/span> <span class=\"hljs-keyword\">object<\/span>();\n<span class=\"hljs-keyword\">var<\/span> lock2 = <span class=\"hljs-keyword\">new<\/span> <span class=\"hljs-keyword\">object<\/span>();\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">void<\/span> <span class=\"hljs-title\">AcquireLocks1<\/span>(<span class=\"hljs-params\"><\/span>)<\/span>\n{\n    <span class=\"hljs-keyword\">var<\/span> threadId = Thread.CurrentThread.ManagedThreadId;\n\n    <span class=\"hljs-keyword\">lock<\/span> (lock1)\n    {\n        WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 1.\"<\/span>);\n        Thread.Sleep(<span class=\"hljs-number\">1000<\/span>);\n        WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> attempted to acquire lock 2.\"<\/span>);\n        <span class=\"hljs-keyword\">lock<\/span> (lock2)\n        {\n            WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 2.\"<\/span>);\n        }\n    }\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">void<\/span> <span class=\"hljs-title\">AcquireLocks2<\/span>(<span class=\"hljs-params\"><\/span>)<\/span>\n{\n    <span class=\"hljs-keyword\">var<\/span> threadId = Thread.CurrentThread.ManagedThreadId;\n\n    <span class=\"hljs-keyword\">lock<\/span> (lock2)\n    {\n        WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 2.\"<\/span>);\n        Thread.Sleep(<span class=\"hljs-number\">1000<\/span>);\n        WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> attempted to acquire lock 1.\"<\/span>);\n        <span class=\"hljs-keyword\">lock<\/span> (lock1)\n        {\n            WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 1.\"<\/span>);\n        }\n    }\n}\n\n<span class=\"hljs-comment\">\/\/ Create two new threads that compete for the locks<\/span>\n<span class=\"hljs-keyword\">var<\/span> thread1 = <span class=\"hljs-keyword\">new<\/span> Thread(AcquireLocks1);\n<span class=\"hljs-keyword\">var<\/span> thread2 = <span class=\"hljs-keyword\">new<\/span> Thread(AcquireLocks2);\n\n<span class=\"hljs-comment\">\/\/ Start the threads<\/span>\nthread1.Start();\nthread2.Start();\n\n<span class=\"hljs-comment\">\/\/ Wait for the threads to complete<\/span>\nthread1.Join();\nthread2.Join();\n\nWriteLine(<span class=\"hljs-string\">\"Finished.\"<\/span>);\nReadLine();<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">C#<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">cs<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>How it works.<\/p>\n\n\n\n<p>First, create two lock objects lock1 and lock2:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"C#\" data-shcb-language-slug=\"cs\"><span><code class=\"hljs language-cs\"><span class=\"hljs-keyword\">var<\/span> lock1 = <span class=\"hljs-keyword\">new<\/span> <span class=\"hljs-keyword\">object<\/span>();\n<span class=\"hljs-keyword\">var<\/span> lock2 = <span class=\"hljs-keyword\">new<\/span> <span class=\"hljs-keyword\">object<\/span>();<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">C#<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">cs<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Second, define the <code>AcquireLock1<\/code> method that acquires lock1, delays for one second, and attempts to acquire lock2:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"C#\" data-shcb-language-slug=\"cs\"><span><code class=\"hljs language-cs\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">void<\/span> <span class=\"hljs-title\">AcquireLocks1<\/span>(<span class=\"hljs-params\"><\/span>)<\/span>\n{\n    <span class=\"hljs-keyword\">var<\/span> threadId = Thread.CurrentThread.ManagedThreadId;\n\n    <span class=\"hljs-keyword\">lock<\/span> (lock1)\n    {\n        WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 1.\"<\/span>);\n        Thread.Sleep(<span class=\"hljs-number\">1000<\/span>);\n        WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> attempted to acquire lock 2.\"<\/span>);\n        <span class=\"hljs-keyword\">lock<\/span> (lock2)\n        {\n            WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 2.\"<\/span>);\n        }\n    }\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">C#<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">cs<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Third, define <code>AcquireLock2()<\/code> method that acquires lock2, delays for one second, and attempts to acquire lock1:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"C#\" data-shcb-language-slug=\"cs\"><span><code class=\"hljs language-cs\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">void<\/span> <span class=\"hljs-title\">AcquireLocks2<\/span>(<span class=\"hljs-params\"><\/span>)<\/span>\n{\n    <span class=\"hljs-keyword\">var<\/span> threadId = Thread.CurrentThread.ManagedThreadId;\n\n    <span class=\"hljs-keyword\">lock<\/span> (lock2)\n    {\n        WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 2.\"<\/span>);\n        Thread.Sleep(<span class=\"hljs-number\">1000<\/span>);\n        WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> attempted to acquire lock 1.\"<\/span>);\n        <span class=\"hljs-keyword\">lock<\/span> (lock1)\n        {\n            WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 1.\"<\/span>);\n        }\n    }\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">C#<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">cs<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Fourth, create two threads, start them, and wait for them to complete:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"C#\" data-shcb-language-slug=\"cs\"><span><code class=\"hljs language-cs\"><span class=\"hljs-comment\">\/\/ Create two new threads that compete for the locks<\/span>\n<span class=\"hljs-keyword\">var<\/span> thread1 = <span class=\"hljs-keyword\">new<\/span> Thread(AcquireLocks1);\n<span class=\"hljs-keyword\">var<\/span> thread2 = <span class=\"hljs-keyword\">new<\/span> Thread(AcquireLocks2);\n\n<span class=\"hljs-comment\">\/\/ Start the threads<\/span>\nthread1.Start();\nthread2.Start();\n\n<span class=\"hljs-comment\">\/\/ Wait for the threads to complete<\/span>\nthread1.Join();\nthread2.Join();<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">C#<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">cs<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"C#\" data-shcb-language-slug=\"cs\"><span><code class=\"hljs language-cs\">Thread <span class=\"hljs-number\">10<\/span> acquired <span class=\"hljs-keyword\">lock<\/span> <span class=\"hljs-number\">1.<\/span>\nThread <span class=\"hljs-number\">11<\/span> acquired <span class=\"hljs-keyword\">lock<\/span> <span class=\"hljs-number\">2.<\/span>\nThread <span class=\"hljs-number\">10<\/span> attempted to acquire <span class=\"hljs-keyword\">lock<\/span> <span class=\"hljs-number\">2.<\/span>\nThread <span class=\"hljs-number\">11<\/span> attempted to acquire <span class=\"hljs-keyword\">lock<\/span> <span class=\"hljs-number\">1.<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">C#<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">cs<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Thread1 executes the AcquireLock1 method while thread2 executes the <code>AcquireLock2<\/code> method.<\/p>\n\n\n\n<p>Because thread1 is holding the lock1, thread2 is blocked from acquiring the lock1. So thread2 is waiting for thread1 to release the lock1. <\/p>\n\n\n\n<p>Meanwhile, thread2 is holding the lock2, and thread1 is blocked from acquiring the lock1. The thread1 is waiting for thread2 to release the lock2.<\/p>\n\n\n\n<p>Both threads are waiting for each other to get the corresponding locks before proceeding next, which results in a deadlock.<\/p>\n\n\n\n<p>As the result, the program will hang indefinitely, and you&#8217;ll never see the &#8220;Finished&#8221; message on the console.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Fixing a deadlock<\/h2>\n\n\n\n<p>To fix a deadlock, you can use one of the following techniques:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Avoid holding a lock for too long: when a thread holds a lock for too long, it may cause a deadlock. To avoid it, you need to make sure that you release the lock as soon as you don&#8217;t need it. <\/li>\n\n\n\n<li>Avoid nested locks: It&#8217;s difficult to manage nested locks. And one of the common causes of a deadlock is using nested locks. If you have to use multiple locks, try to acquire them in a fixed order to avoid deadlocks.<\/li>\n\n\n\n<li>Use a timeout: the timeout can help prevent a deadlock from occurring. If a thread is waiting for a lock for a certain time that exceeds the timeout, you can throw an exception or take other actions.<\/li>\n\n\n\n<li>Use asynchronous programming technique: asynchronous programming allows multiple threads to run concurrently without blocking each other, which helps avoid deadlocks.<\/li>\n<\/ul>\n\n\n\n<p>The following program demonstrates how to use a timeout to fix a deadlock in the above program:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"C#\" data-shcb-language-slug=\"cs\"><span><code class=\"hljs language-cs\"><span class=\"hljs-keyword\">using<\/span> <span class=\"hljs-keyword\">static<\/span> System.Console; \n\n<span class=\"hljs-keyword\">var<\/span> lock1 = <span class=\"hljs-keyword\">new<\/span> <span class=\"hljs-keyword\">object<\/span>();\n<span class=\"hljs-keyword\">var<\/span> lock2 = <span class=\"hljs-keyword\">new<\/span> <span class=\"hljs-keyword\">object<\/span>();\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">void<\/span> <span class=\"hljs-title\">AcquireLocks1<\/span>(<span class=\"hljs-params\"><\/span>)<\/span>\n{\n    <span class=\"hljs-keyword\">var<\/span> threadId = Thread.CurrentThread.ManagedThreadId;\n\n    <span class=\"hljs-keyword\">while<\/span> (<span class=\"hljs-literal\">true<\/span>)\n    {\n        <span class=\"hljs-keyword\">if<\/span> (Monitor.TryEnter(lock1, TimeSpan.FromSeconds(<span class=\"hljs-number\">1<\/span>)))\n        {\n            <span class=\"hljs-keyword\">try<\/span>\n            {\n                WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 1.\"<\/span>);\n                Thread.Sleep(<span class=\"hljs-number\">1000<\/span>);\n                WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> attempted to acquire lock 2.\"<\/span>);\n\n                <span class=\"hljs-keyword\">if<\/span> (Monitor.TryEnter(lock2, TimeSpan.FromSeconds(<span class=\"hljs-number\">1<\/span>)))\n                {\n                    <span class=\"hljs-keyword\">try<\/span>\n                    {\n                        WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 2.\"<\/span>);\n                        <span class=\"hljs-keyword\">break<\/span>; <span class=\"hljs-comment\">\/\/ exit the loop if both locks are acquired<\/span>\n                    }\n                    <span class=\"hljs-keyword\">finally<\/span>\n                    {\n                        Monitor.Exit(lock2);\n                    }\n                }\n            }\n            <span class=\"hljs-keyword\">finally<\/span>\n            {\n                Monitor.Exit(lock1);\n            }\n        }\n    }\n\n    WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> is done.\"<\/span>);\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">void<\/span> <span class=\"hljs-title\">AcquireLocks2<\/span>(<span class=\"hljs-params\"><\/span>)<\/span>\n{\n    <span class=\"hljs-keyword\">var<\/span> threadId = Thread.CurrentThread.ManagedThreadId;\n\n    <span class=\"hljs-keyword\">while<\/span> (<span class=\"hljs-literal\">true<\/span>)\n    {\n        <span class=\"hljs-keyword\">if<\/span> (Monitor.TryEnter(lock2, TimeSpan.FromSeconds(<span class=\"hljs-number\">1<\/span>)))\n        {\n            <span class=\"hljs-keyword\">try<\/span>\n            {\n                WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 2.\"<\/span>);\n                Thread.Sleep(<span class=\"hljs-number\">1000<\/span>);\n                WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> attempted to acquire lock 1.\"<\/span>);\n\n                <span class=\"hljs-keyword\">if<\/span> (Monitor.TryEnter(lock1, TimeSpan.FromSeconds(<span class=\"hljs-number\">1<\/span>)))\n                {\n                    <span class=\"hljs-keyword\">try<\/span>\n                    {\n                        WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> acquired lock 1.\"<\/span>);\n                        <span class=\"hljs-keyword\">break<\/span>; <span class=\"hljs-comment\">\/\/ exit the loop if both locks are acquired<\/span>\n                    }\n                    <span class=\"hljs-keyword\">finally<\/span>\n                    {\n                        Monitor.Exit(lock1);\n                    }\n                }\n            }\n            <span class=\"hljs-keyword\">finally<\/span>\n            {\n                Monitor.Exit(lock2);\n            }\n        }\n    }\n\n    WriteLine(<span class=\"hljs-string\">$\"Thread <span class=\"hljs-subst\">{threadId}<\/span> is done.\"<\/span>);\n}\n\n<span class=\"hljs-comment\">\/\/ Create two new threads that compete for the locks<\/span>\n<span class=\"hljs-keyword\">var<\/span> thread1 = <span class=\"hljs-keyword\">new<\/span> Thread(AcquireLocks1);\n<span class=\"hljs-keyword\">var<\/span> thread2 = <span class=\"hljs-keyword\">new<\/span> Thread(AcquireLocks2);\n\n<span class=\"hljs-comment\">\/\/ Start the threads<\/span>\nthread1.Start();\nthread2.Start();\n\n<span class=\"hljs-comment\">\/\/ Wait for the threads to complete<\/span>\nthread1.Join();\nthread2.Join();\n\nWriteLine(<span class=\"hljs-string\">\"Finished.\"<\/span>);\nReadLine();<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">C#<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">cs<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this program, we use the <code><code>Monitor.TryEnter<\/code>()<\/code> to attempt to acquire a lock with a timeout of one second.<\/p>\n\n\n\n<p>If a thread cannot acquire the lock within one second, it releases the lock and tries again. <\/p>\n\n\n\n<p>The while loop keeps trying until both threads can acquire the locks, which breaks the loop and the threads complete their executions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A deadlock occurs when two or more threads are waiting and blocking each other to release locks.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"884\"\n\t\t\t\tdata-post-url=\"https:\/\/www.csharptutorial.net\/csharp-concurrency\/csharp-deadlock\/\"\n\t\t\t\tdata-post-title=\"C# Deadlock\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"884\"\n\t\t\t\tdata-post-url=\"https:\/\/www.csharptutorial.net\/csharp-concurrency\/csharp-deadlock\/\"\n\t\t\t\tdata-post-title=\"C# Deadlock\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn about the C# deadlock, how it occurs, and how to fix it using various techniques.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":760,"menu_order":11,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-884","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/pages\/884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/comments?post=884"}],"version-history":[{"count":3,"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/pages\/884\/revisions"}],"predecessor-version":[{"id":889,"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/pages\/884\/revisions\/889"}],"up":[{"embeddable":true,"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/pages\/760"}],"wp:attachment":[{"href":"https:\/\/www.csharptutorial.net\/wp-json\/wp\/v2\/media?parent=884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}